@undefineds.co/linx 0.3.20 → 0.3.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/generated/version.js +1 -1
  2. package/dist/index.js +6 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/lib/auto-mode/pod-persistence.js +53 -3
  5. package/dist/lib/auto-mode/pod-persistence.js.map +1 -1
  6. package/dist/lib/auto-mode/secretary.js +2 -2
  7. package/dist/lib/auto-mode/secretary.js.map +1 -1
  8. package/dist/lib/chat-api.js +23 -61
  9. package/dist/lib/chat-api.js.map +1 -1
  10. package/dist/lib/codex-plugin/index.js +1 -0
  11. package/dist/lib/codex-plugin/index.js.map +1 -1
  12. package/dist/lib/codex-plugin/symphony-mcp.js +335 -0
  13. package/dist/lib/codex-plugin/symphony-mcp.js.map +1 -0
  14. package/dist/lib/linx-cloud-errors.js +0 -5
  15. package/dist/lib/linx-cloud-errors.js.map +1 -1
  16. package/dist/lib/linx-status-line.js +1 -8
  17. package/dist/lib/linx-status-line.js.map +1 -1
  18. package/dist/lib/linx-tui-contract.js +2 -1
  19. package/dist/lib/linx-tui-contract.js.map +1 -1
  20. package/dist/lib/models.js +3 -2
  21. package/dist/lib/models.js.map +1 -1
  22. package/dist/lib/pi-adapter/auth.js +68 -0
  23. package/dist/lib/pi-adapter/auth.js.map +1 -0
  24. package/dist/lib/pi-adapter/branding.js +67 -110
  25. package/dist/lib/pi-adapter/branding.js.map +1 -1
  26. package/dist/lib/pi-adapter/interactive.js +341 -101
  27. package/dist/lib/pi-adapter/interactive.js.map +1 -1
  28. package/dist/lib/pi-adapter/pod-mirror.js +38 -107
  29. package/dist/lib/pi-adapter/pod-mirror.js.map +1 -1
  30. package/dist/lib/pi-adapter/pod-native.js +2 -0
  31. package/dist/lib/pi-adapter/pod-native.js.map +1 -1
  32. package/dist/lib/pi-adapter/pod-tools.js +140 -0
  33. package/dist/lib/pi-adapter/pod-tools.js.map +1 -0
  34. package/dist/lib/pi-adapter/runtime.js +2 -12
  35. package/dist/lib/pi-adapter/runtime.js.map +1 -1
  36. package/dist/lib/pi-adapter/session.js +13 -17
  37. package/dist/lib/pi-adapter/session.js.map +1 -1
  38. package/dist/lib/pi-adapter/stream.js +2 -20
  39. package/dist/lib/pi-adapter/stream.js.map +1 -1
  40. package/dist/lib/pod-chat-store.js +53 -4
  41. package/dist/lib/pod-chat-store.js.map +1 -1
  42. package/dist/lib/resource-identity.js +2 -0
  43. package/dist/lib/resource-identity.js.map +1 -0
  44. package/dist/lib/status-line-command.js +2 -2
  45. package/dist/lib/status-line-command.js.map +1 -1
  46. package/dist/lib/symphony/archive.js +15 -37
  47. package/dist/lib/symphony/archive.js.map +1 -1
  48. package/dist/lib/symphony/pod-projection.js +189 -1346
  49. package/dist/lib/symphony/pod-projection.js.map +1 -1
  50. package/dist/lib/symphony-command.js +209 -109
  51. package/dist/lib/symphony-command.js.map +1 -1
  52. package/dist/plugins/linx-symphony-codex/.codex-plugin/plugin.json +38 -0
  53. package/dist/plugins/linx-symphony-codex/.mcp.json +10 -0
  54. package/dist/plugins/linx-symphony-codex/README.md +9 -0
  55. package/dist/plugins/linx-symphony-codex/hooks.json +60 -0
  56. package/dist/plugins/linx-symphony-codex/scripts/symphony-hook-events.mjs +119 -0
  57. package/dist/plugins/linx-symphony-codex/scripts/symphony-mcp.mjs +335 -0
  58. package/dist/plugins/linx-symphony-codex/skills/symphony/SKILL.md +791 -0
  59. package/dist/skills/symphony/SKILL.md +7 -0
  60. package/dist/skills/xpod-cli/SKILL.md +2 -13
  61. package/package.json +4 -4
  62. package/vendor/agent-runtime/dist/chat-reconciler.d.ts +33 -0
  63. package/vendor/agent-runtime/dist/chat-reconciler.js +108 -0
  64. package/vendor/agent-runtime/dist/index.d.ts +4 -1
  65. package/vendor/agent-runtime/dist/index.js +4 -1
  66. package/vendor/agent-runtime/dist/matrix-client.d.ts +149 -0
  67. package/vendor/agent-runtime/dist/matrix-client.js +220 -0
  68. package/vendor/agent-runtime/dist/pod-resource-identity.d.ts +17 -0
  69. package/vendor/agent-runtime/dist/pod-resource-identity.js +54 -0
  70. package/vendor/agent-runtime/dist/reconciler.d.ts +0 -11
  71. package/vendor/agent-runtime/dist/reconciler.js +5 -43
  72. package/vendor/agent-runtime/dist/symphony.d.ts +272 -27
  73. package/vendor/agent-runtime/dist/symphony.js +1268 -21
  74. package/vendor/agent-runtime/dist/workspace.d.ts +61 -0
  75. package/vendor/agent-runtime/dist/workspace.js +81 -0
  76. package/vendor/agent-runtime/package.json +5 -1
  77. package/vendor/stores/dist/current-pod-base.d.ts +2 -0
  78. package/vendor/stores/dist/current-pod-base.js +14 -0
  79. package/vendor/stores/dist/exact-records.d.ts +7 -0
  80. package/vendor/stores/dist/exact-records.js +87 -0
  81. package/vendor/stores/dist/index.d.ts +1 -0
  82. package/vendor/stores/dist/index.js +1 -0
  83. package/vendor/stores/dist/login.d.ts +51 -0
  84. package/vendor/stores/dist/login.js +195 -0
  85. package/vendor/stores/dist/pod-collection.d.ts +28 -0
  86. package/vendor/stores/dist/pod-collection.js +194 -0
  87. package/vendor/stores/dist/pod-write-guard.d.ts +5 -0
  88. package/vendor/stores/dist/pod-write-guard.js +133 -0
  89. package/vendor/stores/dist/symphony-control.d.ts +245 -0
  90. package/vendor/stores/dist/symphony-control.js +2175 -0
  91. package/vendor/stores/package.json +14 -0
  92. package/dist/lib/capture/persistence.js +0 -377
  93. package/dist/lib/capture/persistence.js.map +0 -1
  94. package/dist/lib/capture/tool.js +0 -242
  95. package/dist/lib/capture/tool.js.map +0 -1
  96. package/dist/skills/basic/SKILL.md +0 -46
  97. package/dist/skills/capture/SKILL.md +0 -165
  98. package/vendor/agent-runtime/dist/coordination.d.ts +0 -93
  99. package/vendor/agent-runtime/dist/coordination.js +0 -145
@@ -0,0 +1,194 @@
1
+ import { createCollection } from '@tanstack/react-db';
2
+ import { queryCollectionOptions } from '@tanstack/query-db-collection';
3
+ import { asBaseRelativeResourceId, requireRowResourceId } from '../../agent-runtime/dist/pod-resource-identity.js';
4
+ import { deleteExactRecord, updateExactRecord } from './exact-records.js';
5
+ function isPodCollectionDebugEnabled() {
6
+ return typeof process !== 'undefined'
7
+ && (process.env.LINX_POD_COLLECTION_DEBUG === '1' || process.env.LINX_POD_COLLECTION_DEBUG === 'true');
8
+ }
9
+ function debugPodCollection(...args) {
10
+ if (isPodCollectionDebugEnabled())
11
+ console.log(...args);
12
+ }
13
+ /**
14
+ * Creates a TanStack DB Collection synchronized with a Solid Pod resource.
15
+ * Includes support for real-time subscriptions via db.subscribe().
16
+ */
17
+ export function createPodCollection(options) {
18
+ const { resource, queryKey, queryClient, getDb, columns, orderBy, getKey: customGetKey, seed } = options;
19
+ const ensureId = (item, operation) => {
20
+ if (item.id) {
21
+ asBaseRelativeResourceId(item.id, 'Pod collection row.id');
22
+ return item;
23
+ }
24
+ if (operation === 'seed') {
25
+ const id = asBaseRelativeResourceId(crypto.randomUUID(), 'generated Pod collection row.id');
26
+ if (typeof item === 'object' && item) {
27
+ return Object.assign(item, { id });
28
+ }
29
+ return { ...item, id };
30
+ }
31
+ throw new Error('Cannot persist Pod collection item without row.id.');
32
+ };
33
+ // Default key extractor: id required after insert/read
34
+ const getKey = customGetKey ?? ((item) => {
35
+ return requireRowResourceId(item, 'collection item');
36
+ });
37
+ let didSeed = false;
38
+ const fetchRows = async () => {
39
+ const db = getDb();
40
+ if (!db)
41
+ return [];
42
+ const buildQuery = () => {
43
+ let query;
44
+ if (columns && columns.length > 0) {
45
+ const selectObj = {};
46
+ for (const col of columns) {
47
+ selectObj[col] = resource[col];
48
+ }
49
+ query = db.select(selectObj).from(resource);
50
+ }
51
+ else {
52
+ query = db.select().from(resource);
53
+ }
54
+ if (orderBy?.column) {
55
+ query = query.orderBy(orderBy.column, orderBy.direction ?? 'asc');
56
+ }
57
+ return query;
58
+ };
59
+ let rows;
60
+ try {
61
+ rows = (await buildQuery().execute());
62
+ }
63
+ catch (error) {
64
+ if (isUnsupportedDocumentCollectionRead(error)) {
65
+ console.warn(`[PodCollection] ${queryKey.join('/')} fetch skipped: ${errorMessage(error)}`);
66
+ return [];
67
+ }
68
+ console.error(`[PodCollection] ${queryKey.join('/')} fetch failed:`, error);
69
+ throw error;
70
+ }
71
+ for (const row of rows) {
72
+ requireRowResourceId(row, 'Pod collection row');
73
+ }
74
+ if (!didSeed && rows.length === 0 && seed) {
75
+ const seedRows = typeof seed === 'function' ? seed() : seed;
76
+ if (seedRows.length > 0) {
77
+ const ensured = seedRows.map((row) => ensureId(row, 'seed'));
78
+ await db.insert(resource).values(ensured).execute();
79
+ didSeed = true;
80
+ rows = (await buildQuery().execute());
81
+ }
82
+ else {
83
+ didSeed = true;
84
+ }
85
+ }
86
+ return rows;
87
+ };
88
+ // 1. Create the base collection
89
+ const collection = createCollection(queryCollectionOptions({
90
+ queryKey,
91
+ queryClient,
92
+ // READ
93
+ queryFn: fetchRows,
94
+ // IDENTITY
95
+ getKey,
96
+ // CREATE
97
+ onInsert: async ({ transaction }) => {
98
+ const db = getDb();
99
+ if (!db)
100
+ throw new Error('Database not connected');
101
+ const { modified } = transaction.mutations[0];
102
+ const ensured = ensureId(modified, 'insert');
103
+ const payload = toPersistableInsert(ensured, resource);
104
+ await db.insert(resource).values(payload).execute();
105
+ },
106
+ // UPDATE
107
+ onUpdate: async ({ transaction }) => {
108
+ const db = getDb();
109
+ if (!db)
110
+ throw new Error('Database not connected');
111
+ const { original, modified } = transaction.mutations[0];
112
+ try {
113
+ await updateExactRecord(db, resource, (original ?? modified), modified);
114
+ }
115
+ catch (error) {
116
+ console.error(`[PodCollection] Update failed for ${queryKey.join('/')}:`, error);
117
+ throw error;
118
+ }
119
+ },
120
+ // DELETE
121
+ onDelete: async ({ transaction }) => {
122
+ const db = getDb();
123
+ if (!db)
124
+ throw new Error('Database not connected');
125
+ const { original } = transaction.mutations[0];
126
+ await deleteExactRecord(db, resource, original);
127
+ }
128
+ }));
129
+ // 2. Attach helpers
130
+ const fetch = async () => {
131
+ if (!collection.isReady()) {
132
+ await collection.preload();
133
+ return collection.toArray;
134
+ }
135
+ const refetch = collection.utils.refetch;
136
+ if (typeof refetch === 'function') {
137
+ await refetch();
138
+ }
139
+ return collection.toArray;
140
+ };
141
+ // Usage: useEffect(() => collection.subscribeToPod(db), [db])
142
+ const subscribeToPod = async (db) => {
143
+ if (typeof db.subscribe !== 'function') {
144
+ console.warn('[PodCollection] db.subscribe not available');
145
+ return () => { };
146
+ }
147
+ try {
148
+ const sub = await db.subscribe(resource, {
149
+ onCreate: async (activity) => {
150
+ debugPodCollection(`[PodCollection] onCreate: ${activity.object}`);
151
+ // 直接 invalidate,让 useQuery 重新获取完整列表
152
+ queryClient.invalidateQueries({ queryKey });
153
+ },
154
+ onUpdate: async (activity) => {
155
+ debugPodCollection(`[PodCollection] onUpdate: ${activity.object}`);
156
+ queryClient.invalidateQueries({ queryKey });
157
+ },
158
+ onDelete: (activity) => {
159
+ debugPodCollection(`[PodCollection] onDelete: ${activity.object}`);
160
+ queryClient.invalidateQueries({ queryKey });
161
+ }
162
+ });
163
+ debugPodCollection(`[PodCollection] Subscribed to ${queryKey.join('/')}`);
164
+ return () => sub.unsubscribe();
165
+ }
166
+ catch (error) {
167
+ console.error(`[PodCollection] Subscription failed`, error);
168
+ return () => { };
169
+ }
170
+ };
171
+ // Extend the collection object with helper methods
172
+ const baseInsert = collection.insert.bind(collection);
173
+ const insert = (item) => baseInsert(ensureId(item, 'insert'));
174
+ return Object.assign(collection, { insert, subscribeToPod, fetch });
175
+ }
176
+ function isUnsupportedDocumentCollectionRead(error) {
177
+ return errorMessage(error).includes('Document-mode collection queries over plain LDP are not supported');
178
+ }
179
+ function errorMessage(error) {
180
+ return error instanceof Error ? error.message : String(error);
181
+ }
182
+ function toPersistableInsert(item, resource) {
183
+ const buildId = resource?.buildId;
184
+ if (typeof buildId !== 'function' || !item.id || looksLikeBaseRelativeResourceId(item.id)) {
185
+ return item;
186
+ }
187
+ return {
188
+ ...item,
189
+ id: buildId.call(resource, { id: item.id }),
190
+ };
191
+ }
192
+ function looksLikeBaseRelativeResourceId(id) {
193
+ return id.includes('/') || id.includes('#') || id.endsWith('.ttl');
194
+ }
@@ -0,0 +1,5 @@
1
+ import type { SolidDatabase } from '@undefineds.co/models';
2
+ export declare function assertIriBelongsToCurrentPod(db: SolidDatabase, iri: string, operation: 'insert' | 'update' | 'delete'): void;
3
+ export declare function assertCurrentPodBaseUrl(db: SolidDatabase, operation: 'insert' | 'update' | 'delete'): string;
4
+ export declare function assertInsertValuesBelongToCurrentPod(db: SolidDatabase, values: unknown): void;
5
+ export declare function assertUpdateValuesBelongToCurrentPod(db: SolidDatabase, values: unknown): void;
@@ -0,0 +1,133 @@
1
+ import { resolveCurrentPodBaseUrl } from './current-pod-base.js';
2
+ const ABSOLUTE_IRI = /^[a-zA-Z][a-zA-Z\d+.-]*:/;
3
+ const SUBJECT_FIELDS = ['@id', 'subject', 'uri', 'source', 'id'];
4
+ const STORAGE_RELATION_FIELDS = [
5
+ 'approval',
6
+ 'chat',
7
+ 'entry',
8
+ 'issue',
9
+ 'issues',
10
+ 'lastMessageId',
11
+ 'messageResource',
12
+ 'messageResources',
13
+ 'object',
14
+ 'parentIssue',
15
+ 'replyTo',
16
+ 'run',
17
+ 'runStep',
18
+ 'runSteps',
19
+ 'runs',
20
+ 'session',
21
+ 'task',
22
+ 'tasks',
23
+ 'target',
24
+ 'thread',
25
+ 'workspace',
26
+ ];
27
+ const STORAGE_RELATION_URI_FIELDS = [
28
+ 'repoRootUri',
29
+ 'rootUri',
30
+ 'targetUri',
31
+ ];
32
+ export function assertIriBelongsToCurrentPod(db, iri, operation) {
33
+ const currentPodBase = assertCurrentPodBaseUrl(db, operation);
34
+ const podPrefix = normalizePodPrefix(currentPodBase);
35
+ const target = normalizeAbsoluteIri(iri);
36
+ if (!target.startsWith(podPrefix)) {
37
+ throw new Error(`Refusing to ${operation} a Pod record outside the current SP: ${iri}`);
38
+ }
39
+ }
40
+ export function assertCurrentPodBaseUrl(db, operation) {
41
+ const currentPodBase = resolveCurrentPodBaseUrl(db);
42
+ if (!currentPodBase) {
43
+ throw new Error(`Cannot ${operation} Pod record without a current SP Pod URL.`);
44
+ }
45
+ return currentPodBase;
46
+ }
47
+ export function assertInsertValuesBelongToCurrentPod(db, values) {
48
+ assertCurrentPodBaseUrl(db, 'insert');
49
+ for (const iri of collectStorageSensitiveIris(values)) {
50
+ assertIriBelongsToCurrentPod(db, iri, 'insert');
51
+ }
52
+ }
53
+ export function assertUpdateValuesBelongToCurrentPod(db, values) {
54
+ assertCurrentPodBaseUrl(db, 'update');
55
+ for (const iri of collectStorageSensitiveIris(values)) {
56
+ assertIriBelongsToCurrentPod(db, iri, 'update');
57
+ }
58
+ }
59
+ function collectStorageSensitiveIris(values) {
60
+ const seen = new Set();
61
+ collectStorageSensitiveIrisInto(values, seen);
62
+ return [...seen];
63
+ }
64
+ function collectStorageSensitiveIrisInto(values, seen) {
65
+ if (Array.isArray(values)) {
66
+ for (const value of values) {
67
+ collectStorageSensitiveIrisInto(value, seen);
68
+ }
69
+ return;
70
+ }
71
+ if (!isSubjectCarrier(values)) {
72
+ return;
73
+ }
74
+ for (const [field, value] of Object.entries(values)) {
75
+ if (typeof value === 'string' && ABSOLUTE_IRI.test(value)) {
76
+ if (shouldGuardFieldIri(field) && isHttpIri(value)) {
77
+ seen.add(value);
78
+ }
79
+ continue;
80
+ }
81
+ if (Array.isArray(value) && shouldGuardFieldIri(field)) {
82
+ for (const item of value) {
83
+ if (typeof item === 'string' && ABSOLUTE_IRI.test(item) && isHttpIri(item)) {
84
+ seen.add(item);
85
+ }
86
+ }
87
+ continue;
88
+ }
89
+ collectStorageSensitiveIrisInto(value, seen);
90
+ }
91
+ }
92
+ function isSubjectCarrier(value) {
93
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
94
+ }
95
+ function isSubjectField(field) {
96
+ return SUBJECT_FIELDS.includes(field);
97
+ }
98
+ function isStorageRelationField(field) {
99
+ return STORAGE_RELATION_FIELDS.includes(field);
100
+ }
101
+ function isStorageRelationUriField(field) {
102
+ if (STORAGE_RELATION_URI_FIELDS.includes(field)) {
103
+ return true;
104
+ }
105
+ if (!field.endsWith('Uri')) {
106
+ return false;
107
+ }
108
+ const baseName = field.slice(0, -3);
109
+ return isStorageRelationField(baseName);
110
+ }
111
+ function shouldGuardFieldIri(field) {
112
+ return isSubjectField(field) || isStorageRelationField(field) || isStorageRelationUriField(field);
113
+ }
114
+ function normalizePodPrefix(podBaseUrl) {
115
+ return `${podBaseUrl.trim().replace(/\/+$/, '')}/`;
116
+ }
117
+ function normalizeAbsoluteIri(iri) {
118
+ try {
119
+ return new URL(iri).href;
120
+ }
121
+ catch {
122
+ return iri;
123
+ }
124
+ }
125
+ function isHttpIri(iri) {
126
+ try {
127
+ const { protocol } = new URL(iri);
128
+ return protocol === 'http:' || protocol === 'https:';
129
+ }
130
+ catch {
131
+ return false;
132
+ }
133
+ }
@@ -0,0 +1,245 @@
1
+ import type { SymphonyIssueRecord, SymphonyRuntimeEventType, SymphonyRuntimeDeliveryResult, SymphonyRunPlan, SymphonySessionRecord, SymphonyWorkerPlan } from '@linx/agent-runtime/symphony';
2
+ import { type AutoModeInteractionRequest, type AutoModeWorkerBackend } from '@linx/agent-runtime/auto-mode';
3
+ import { type ApprovalInsert, type ChatInsert, type ContactInsert, type DeliveryInsert, type EvidenceInsert, type InboxNotificationInsert, type InputRequestInsert, type IssueInsert, type MessageInsert, type ReportInsert, type RunInsert, type RunStepInsert, type SessionInsert, type SolidDatabase, type TaskInsert, type ThreadInsert } from '@undefineds.co/models';
4
+ import { type ExactRecordDatabase } from '@undefineds.co/drizzle-solid';
5
+ export type SymphonyControlStage = 'planned' | 'running' | 'completed' | 'failed';
6
+ export interface BuildSymphonyControlRowsInput {
7
+ plan: SymphonyRunPlan;
8
+ webId: string;
9
+ stage?: SymphonyControlStage;
10
+ stages?: SymphonyControlStage[];
11
+ }
12
+ export interface SymphonyControlRows {
13
+ contacts: ContactInsert[];
14
+ chats: ChatInsert[];
15
+ threads: ThreadInsert[];
16
+ messages: MessageInsert[];
17
+ issue: IssueInsert;
18
+ issues: IssueInsert[];
19
+ tasks: TaskInsert[];
20
+ deliveries: DeliveryInsert[];
21
+ sessions: SessionInsert[];
22
+ runs: RunInsert[];
23
+ runSteps: RunStepInsert[];
24
+ evidence: EvidenceInsert[];
25
+ reports: ReportInsert[];
26
+ }
27
+ export interface PersistSymphonyControlStateInput extends BuildSymphonyControlRowsInput {
28
+ db: SolidDatabase & ExactRecordDatabase;
29
+ }
30
+ export interface PersistSymphonyControlStateResult {
31
+ plan: SymphonyRunPlan;
32
+ rows: SymphonyControlRows;
33
+ }
34
+ export interface SymphonyRuntimeAdapterEvent {
35
+ stepType: SymphonyRuntimeEventType;
36
+ message?: string;
37
+ payload?: Record<string, unknown>;
38
+ now?: Date;
39
+ randomId?: string;
40
+ }
41
+ export interface SymphonyRuntimeAdapterResult {
42
+ status?: 'completed' | 'failed';
43
+ exitCode?: number;
44
+ autoModeSessionId?: string;
45
+ reportText?: string;
46
+ events?: SymphonyRuntimeAdapterEvent[];
47
+ }
48
+ export interface SymphonyRuntimeAdapter {
49
+ run(input: {
50
+ plan: SymphonyRunPlan;
51
+ worker: SymphonyWorkerPlan;
52
+ prompt: string;
53
+ signal?: AbortSignal;
54
+ }): Promise<SymphonyRuntimeAdapterResult>;
55
+ }
56
+ export interface RunAndPersistSymphonyWorkerGoalPlanInput {
57
+ db: SolidDatabase & ExactRecordDatabase;
58
+ webId: string;
59
+ plan: SymphonyRunPlan;
60
+ runtimeAdapter: SymphonyRuntimeAdapter;
61
+ now?: Date;
62
+ randomId?: string;
63
+ signal?: AbortSignal;
64
+ }
65
+ export interface RunAndPersistSymphonyWorkerGoalPlanResult {
66
+ plan: SymphonyRunPlan;
67
+ worker: SymphonyWorkerPlan;
68
+ status: 'completed' | 'failed';
69
+ exitCode: number;
70
+ autoModeSessionId?: string;
71
+ }
72
+ export interface ApplyAndPersistSymphonyWorkerRuntimeResultInput {
73
+ db: SolidDatabase & ExactRecordDatabase;
74
+ webId: string;
75
+ plan: SymphonyRunPlan;
76
+ worker?: Worker;
77
+ result: SymphonyRuntimeAdapterResult | SymphonyRuntimeDeliveryResult;
78
+ now?: Date;
79
+ randomId?: string;
80
+ }
81
+ export interface ApplyAndPersistSymphonyWorkerRuntimeResultResult {
82
+ plan: SymphonyRunPlan;
83
+ worker: SymphonyWorkerPlan;
84
+ status: 'completed' | 'failed';
85
+ exitCode: number;
86
+ autoModeSessionId?: string;
87
+ }
88
+ export interface PersistSymphonyWorkerDeliveryInput {
89
+ db: SolidDatabase & ExactRecordDatabase;
90
+ webId: string;
91
+ plan: SymphonyRunPlan;
92
+ worker?: Worker;
93
+ delivery: unknown;
94
+ now?: Date;
95
+ randomId?: string;
96
+ }
97
+ export type PersistSymphonyWorkerDeliveryResult = ApplyAndPersistSymphonyWorkerRuntimeResultResult;
98
+ export interface BuildSymphonyInteractionRequestRowsInput {
99
+ plan: SymphonyRunPlan;
100
+ webId: string;
101
+ request: AutoModeInteractionRequest;
102
+ worker?: Worker;
103
+ now?: Date;
104
+ randomId?: string;
105
+ source?: 'codex-app-server' | 'codex-acp' | 'acp' | 'runtime' | (string & {});
106
+ policyVersion?: string;
107
+ }
108
+ export interface SymphonyInteractionRequestRows {
109
+ approval?: ApprovalInsert;
110
+ inputRequest?: InputRequestInsert;
111
+ inboxNotification: InboxNotificationInsert;
112
+ runStep: RunStepInsert;
113
+ }
114
+ export interface PersistSymphonyInteractionRequestInput extends BuildSymphonyInteractionRequestRowsInput {
115
+ db: SolidDatabase & ExactRecordDatabase;
116
+ }
117
+ export interface PersistSymphonyInteractionRequestResult {
118
+ plan: SymphonyRunPlan;
119
+ rows: SymphonyInteractionRequestRows;
120
+ }
121
+ export interface SymphonyControlWorkerStatus {
122
+ status: string;
123
+ backend: string;
124
+ mode: string;
125
+ cwd?: string;
126
+ autoModeSessionId?: string;
127
+ target?: {
128
+ label?: string;
129
+ agent?: string;
130
+ chat?: string;
131
+ };
132
+ }
133
+ export interface SymphonyControlReportStatus {
134
+ status: string;
135
+ backend: string;
136
+ agent?: string;
137
+ title?: string;
138
+ summary?: string;
139
+ task?: string;
140
+ delivery?: string;
141
+ reportDelivery?: string;
142
+ run?: string;
143
+ chat?: string;
144
+ thread?: string;
145
+ autoModeSessionId?: string;
146
+ error?: string;
147
+ completedAt?: string;
148
+ updatedAt?: string;
149
+ }
150
+ export declare const SYMPHONY_SECRETARY_AGENT_ID = "__secretary__";
151
+ export declare const SYMPHONY_CHAT_ID = "symphony";
152
+ export declare const SYMPHONY_POLICY_VERSION = "linx-symphony-session/v1";
153
+ export declare const SYMPHONY_WORKER_POD_ACCESS_POLICY_VERSION = "linx-symphony-worker-pod-access/v1";
154
+ export declare const SYMPHONY_ARCHIVE_PROVENANCE_VERSION = "linx-symphony-archive/v1";
155
+ export declare const SYMPHONY_RUNTIME_REQUEST_POLICY_VERSION = "linx-symphony-runtime-request/v1";
156
+ type Worker = SymphonyRunPlan['workers'][number];
157
+ type SymphonyArchiveRefs = Partial<Record<'idea' | 'issue' | 'task' | 'delivery' | 'session', string>>;
158
+ export declare function persistSymphonyControlState(input: PersistSymphonyControlStateInput): Promise<PersistSymphonyControlStateResult>;
159
+ export declare function runAndPersistSymphonyWorkerGoalPlan(input: RunAndPersistSymphonyWorkerGoalPlanInput): Promise<RunAndPersistSymphonyWorkerGoalPlanResult>;
160
+ export declare function persistSymphonyWorkerDelivery(input: PersistSymphonyWorkerDeliveryInput): Promise<PersistSymphonyWorkerDeliveryResult>;
161
+ export declare function applyAndPersistSymphonyWorkerRuntimeResult(input: ApplyAndPersistSymphonyWorkerRuntimeResultInput): Promise<ApplyAndPersistSymphonyWorkerRuntimeResultResult>;
162
+ export declare function persistSymphonyInteractionRequest(input: PersistSymphonyInteractionRequestInput): Promise<PersistSymphonyInteractionRequestResult>;
163
+ export declare function listOpenSymphonyIssuesFromControlState(input: {
164
+ db: SolidDatabase;
165
+ webId: string;
166
+ }): Promise<SymphonyIssueRecord[]>;
167
+ export declare function listRunningSymphonyWorkersFromControlState(input: {
168
+ db: SolidDatabase;
169
+ }): Promise<SymphonyControlWorkerStatus[]>;
170
+ export declare function listRecentSymphonyReportsFromControlState(input: {
171
+ db: SolidDatabase;
172
+ limit?: number;
173
+ }): Promise<SymphonyControlReportStatus[]>;
174
+ export declare function buildSymphonyControlRows(input: BuildSymphonyControlRowsInput): SymphonyControlRows;
175
+ export declare function buildSymphonyInteractionRequestRows(input: BuildSymphonyInteractionRequestRowsInput): SymphonyInteractionRequestRows;
176
+ export declare function upsertSymphonyApprovalRequest(db: ExactRecordDatabase, row: ApprovalInsert): Promise<void>;
177
+ export declare function upsertSymphonyInputRequest(db: ExactRecordDatabase, row: InputRequestInsert): Promise<void>;
178
+ export declare function upsertSymphonyContact(db: ExactRecordDatabase, row: ContactInsert): Promise<void>;
179
+ export declare function upsertSymphonyChat(db: ExactRecordDatabase, row: ChatInsert): Promise<void>;
180
+ export declare function upsertSymphonyThread(db: ExactRecordDatabase, row: ThreadInsert): Promise<void>;
181
+ export declare function upsertSymphonyReport(db: ExactRecordDatabase, row: ReportInsert): Promise<void>;
182
+ export declare function upsertSymphonyIssue(db: ExactRecordDatabase, row: IssueInsert): Promise<void>;
183
+ export declare function upsertSymphonyTask(db: ExactRecordDatabase, row: TaskInsert): Promise<void>;
184
+ export declare function upsertSymphonyDelivery(db: ExactRecordDatabase, row: DeliveryInsert): Promise<void>;
185
+ export declare function upsertSymphonySession(db: ExactRecordDatabase, row: SessionInsert): Promise<void>;
186
+ export declare function upsertSymphonyRun(db: ExactRecordDatabase, row: RunInsert): Promise<void>;
187
+ export declare function buildSymphonyIssueRow(plan: SymphonyRunPlan, webId: string, issue?: SymphonyIssueRecord): IssueInsert;
188
+ export declare function buildSymphonyTaskRow(plan: SymphonyRunPlan, webId: string, worker: Worker): TaskInsert;
189
+ export declare function buildSymphonyDeliveryRow(plan: SymphonyRunPlan, webId: string, worker: Worker): DeliveryInsert;
190
+ export declare function buildSymphonySessionRow(plan: SymphonyRunPlan, webId: string, worker?: Worker): SessionInsert;
191
+ export declare function buildSymphonyRunRow(plan: SymphonyRunPlan, webId: string, worker: Worker): RunInsert;
192
+ export declare function buildSymphonyRunStepRow(plan: SymphonyRunPlan, webId: string, worker: Worker, stage: SymphonyControlStage): RunStepInsert;
193
+ export declare function buildSymphonyRuntimeRunStepRow(plan: SymphonyRunPlan, webId: string, worker: Worker, step: NonNullable<Worker['runSteps']>[number]): RunStepInsert;
194
+ export declare function buildSymphonyContactRows(plan: SymphonyRunPlan, webId: string): ContactInsert[];
195
+ export declare function buildSymphonyChatRow(plan: SymphonyRunPlan, webId: string, stage: SymphonyControlStage): ChatInsert;
196
+ export declare function buildSymphonyThreadRows(plan: SymphonyRunPlan, webId: string, stage: SymphonyControlStage): ThreadInsert[];
197
+ export declare function buildSymphonyThreadRow(plan: SymphonyRunPlan, webId: string, stage: SymphonyControlStage, group?: SymphonyThreadProjectionGroup): ThreadInsert;
198
+ export declare function buildSymphonyStatusMessageRow(plan: SymphonyRunPlan, webId: string, stage: SymphonyControlStage): MessageInsert;
199
+ export declare function buildSymphonyEvidenceRows(plan: SymphonyRunPlan, webId: string, worker: Worker): EvidenceInsert[];
200
+ export declare function buildSymphonyReportRows(plan: SymphonyRunPlan, webId: string, worker: Worker): ReportInsert[];
201
+ export declare function buildSymphonyWorkerSummary(plan: SymphonyRunPlan, webId: string, worker: Worker): Record<string, unknown>;
202
+ export declare function buildSymphonyReconcilerMetadata(worker: Worker): Record<string, unknown>;
203
+ export declare function buildSymphonyWorkerPodAccessPolicy(plan: SymphonyRunPlan, webId: string, worker: Worker): Record<string, unknown>;
204
+ export declare function buildSymphonySpaceContract(plan: SymphonyRunPlan, webId: string, worker: Worker): Record<string, unknown>;
205
+ export declare function buildSymphonyWorkspaceMetadata(plan: SymphonyRunPlan, worker: Worker): Record<string, unknown>;
206
+ export declare function buildSymphonyArchiveRefs(refs: SymphonyArchiveRefs): Record<string, string>;
207
+ export declare function buildSymphonyArchiveMetadata(refs: SymphonyArchiveRefs): {
208
+ archive: Record<string, string>;
209
+ };
210
+ export declare function buildSymphonyIssueId(issue: SymphonyIssueRecord): string;
211
+ export declare function buildSymphonyIssueIri(webId: string, issue: SymphonyIssueRecord | string): string;
212
+ export declare function normalizeSymphonyIssueIri(webId: string, issue: string): string;
213
+ export declare function buildSymphonyTaskKey(task: string): string;
214
+ export declare function buildSymphonyTaskIri(webId: string, task: string): string;
215
+ export declare function normalizeSymphonyTaskIri(webId: string, task: string): string;
216
+ export declare function buildSymphonyDeliveryIri(webId: string, worker: Worker): string;
217
+ export declare function buildSymphonyRunIri(webId: string, worker: Worker): string;
218
+ export declare function buildSymphonyWorkerSessionIri(webId: string, worker: Worker): string;
219
+ export declare function buildSymphonyControlSessionIri(webId: string, plan: SymphonyRunPlan): string;
220
+ export declare function buildSymphonySessionRecordId(session: Pick<SymphonySessionRecord, 'uri'>): string;
221
+ export declare function buildSymphonyThreadId(plan: Pick<SymphonyRunPlan, 'session'>): string;
222
+ export declare function buildSymphonyChatUri(webId: string): string;
223
+ export declare function buildTargetChatId(plan: SymphonyRunPlan, webId: string): string;
224
+ export declare function buildSymphonyMessageIri(webId: string, plan: SymphonyRunPlan, row: Pick<MessageInsert, 'id' | 'createdAt'>): string;
225
+ export declare function selectTargetChatIri(value: string | undefined, webId: string, plan?: SymphonyRunPlan): string;
226
+ export declare function selectTargetThreadIri(value: string | undefined, webId: string, plan: SymphonyRunPlan): string;
227
+ export declare function selectDefaultThreadIri(webId: string, plan: SymphonyRunPlan): string;
228
+ export declare function readWorkerChatRef(worker: Worker): string | undefined;
229
+ export declare function readWorkerThreadRef(worker: Worker): string | undefined;
230
+ export declare function readWorkerMessages(worker: Worker): string[];
231
+ export declare function selectWorkerChatIri(plan: SymphonyRunPlan, webId: string, worker: Worker): string;
232
+ export declare function selectWorkerThreadIri(plan: SymphonyRunPlan, webId: string, worker: Worker): string;
233
+ export declare function buildWorkerThreadId(plan: SymphonyRunPlan, webId: string, worker: Worker): string;
234
+ interface SymphonyThreadProjectionGroup {
235
+ chat: string;
236
+ thread: string;
237
+ workers: Worker[];
238
+ }
239
+ export declare function buildWorkerAgentId(backend: AutoModeWorkerBackend, agent?: string): string;
240
+ export declare function mapSymphonyTaskStatus(status: string): string;
241
+ export declare function mapSymphonyRunStatus(status: string): string;
242
+ export declare function mapSymphonyReportOutcome(worker: Worker, outcome?: string): string;
243
+ export declare function inferSymphonyControlStage(plan: SymphonyRunPlan): SymphonyControlStage;
244
+ export declare function buildStatusContent(plan: SymphonyRunPlan, stage: SymphonyControlStage): string;
245
+ export {};