Repository navigation
Expand file tree
/
Copy pathobjectstack.config.ts
More file actions
105 lines (99 loc) · 5.06 KB
/
Copy pathobjectstack.config.ts
File metadata and controls
105 lines (99 loc) · 5.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { defineStack } from '@objectstack/spec';
import { ConnectorRestPlugin } from '@objectstack/connector-rest';
import { ConnectorOpenApiPlugin } from '@objectstack/connector-openapi';
import { ConnectorMcpPlugin } from '@objectstack/connector-mcp';
import * as objects from './src/objects';
import * as views from './src/views';
import * as actions from './src/actions';
import * as flows from './src/flows';
import * as dashboards from './src/dashboards';
import * as apps from './src/apps';
import * as skills from './src/skills';
import * as picklists from './src/picklists';
import * as permissions from './src/security';
import * as datasets from './src/datasets';
import { BrightRuleSeedData } from './src/data/seed';
import { policyQaFunctions, policyQaHooks, policyQaPlugins } from './src/qa';
// Every value a barrel exports, as the list a stack key takes: typed by what
// the barrel exports, and an empty list while it exports nothing yet.
const exportsOf = <M extends object>(barrel: M): M[keyof M][] => Object.values(barrel);
// This file is a MODULE, and the whole module is the stack: the default
// export below is the base, and every NAMED export is merged onto it as a
// top-level stack key under its own name. A helper exported from here is
// therefore read as a stack key and the build refuses it — keep helpers in a
// sibling module and import them. Only names the stack schema declares
// (onEnable, functions, the collections) belong here as named exports.
export default defineStack({
manifest: {
id: 'ai.objectstack.brightrule',
namespace: 'brightrule',
version: '0.1.0',
type: 'app',
name: 'BrightRule',
// Protocol compatibility range: the metadata-protocol major this app is
// authored against. The runtime checks it before it loads anything, so a
// runtime outside the range refuses this app at the boundary with the exact
// migration command instead of crashing later. Scaffolding stamped it to
// match the ObjectStack version you installed — change it when you
// deliberately move to a new protocol major, not to silence a mismatch.
// Guide: https://objectstack.ai/docs/upgrading
engines: { protocol: '^18' },
},
// `automation` backs flow execution and materializes any declarative
// `connectors:` entry into a live, dispatchable connector at boot. The
// connector executors below register their provider factories with it —
// without `automation` loaded they have nowhere to register and boot fails,
// so keep this capability whenever `plugins:` lists a connector.
//
// `triggers` fires a flow that starts on a record change, the kind
// `objectstack generate flow NAME` writes: without it this config stops
// loading once it holds such a flow. It can go if this project will never
// hold one.
// `realtime` carries the record events the policy-inquiry index follows
// (src/qa): a clause written after boot is re-indexed from its event.
// ObjectOS Cloud environments do not provide it and refuse to build an app
// that requires it; they also load no app code plugins, so the index it
// feeds does not run there. `pnpm run deploy` builds with
// BRIGHTRULE_TARGET=cloud, which leaves it out. Local dev and the EE image
// (deploy/objectos-ee) keep it.
requires: [
'automation',
'triggers',
...(process.env.BRIGHTRULE_TARGET === 'cloud' ? [] : (['realtime'] as const)),
],
// Generic connector executors, default-present so you can add a `connectors:`
// entry naming `provider: 'rest' | 'openapi' | 'mcp'` and have it materialize
// with zero host code. Zero-arg = contribute the provider factory only. Brand
// connectors (Slack, …) stay marketplace/opt-in.
// Security: a declarative `mcp` stdio transport spawns a local process from
// metadata, so it is denied by default — opt in per host with
// `new ConnectorMcpPlugin({ declarativeStdio: ['<trusted-command>'] })`.
// Authoring guide: https://objectstack.ai/docs/automation/connectors
plugins: [
new ConnectorRestPlugin(),
new ConnectorOpenApiPlugin(),
new ConnectorMcpPlugin(),
// 制度问询: knowledge service, retrieval engine and the clause index.
...policyQaPlugins(),
],
// 制度问询 lifecycle hooks (src/qa) and the sample policies (src/data).
hooks: policyQaHooks,
functions: policyQaFunctions,
data: BrightRuleSeedData,
// Every directory `objectstack generate` writes into is wired here: its
// index.ts exports what the directory holds, and each list below hands
// those exports to the stack. `objectstack generate view NAME` adds a file
// and one export line, and the view is part of this stack with no edit to
// this file. A directory that is not wired here is never loaded, and
// `objectstack validate` neither counts nor checks what it holds.
objects: exportsOf(objects),
views: exportsOf(views),
actions: exportsOf(actions),
flows: exportsOf(flows),
dashboards: exportsOf(dashboards),
apps: exportsOf(apps),
skills: exportsOf(skills),
picklists: exportsOf(picklists),
permissions: exportsOf(permissions),
datasets: exportsOf(datasets),
});