plugin-agent-orchestrator 1.1.3 → 1.1.4
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.
- package/dist/client/index.js +1 -1
- package/dist/client-v2/214.b063f33ba044a808.js +10 -0
- package/dist/client-v2/253.59577b40d9875be0.js +10 -0
- package/dist/client-v2/264.7ed8bee71fa5935c.js +10 -0
- package/dist/client-v2/{41.ba6e080cc0488143.js → 41.3deb9e57a0f64fc4.js} +1 -1
- package/dist/client-v2/418.58fa350f5496efd3.js +10 -0
- package/dist/client-v2/{53.7c29c28043e9112d.js → 53.9a10455323390f14.js} +1 -1
- package/dist/client-v2/619.0a2144aaffefe018.js +10 -0
- package/dist/client-v2/{70.bda9518881c05360.js → 70.ffff2997c10fd4b0.js} +1 -1
- package/dist/client-v2/{794.9bbb8d3a61b2bdf2.js → 794.a67a2614405ba627.js} +1 -1
- package/dist/client-v2/925.e5925bf21ed68e7a.js +10 -0
- package/dist/client-v2/{993.82778b6fd6db3cb1.js → 993.b0688fdc5ccb000a.js} +1 -1
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +8 -6
- package/dist/locale/en-US.json +48 -28
- package/dist/locale/vi-VN.json +48 -28
- package/dist/locale/zh-CN.json +48 -28
- package/dist/server/collections/agent-execution-spans.js +47 -0
- package/dist/server/collections/agent-harness-profile-versions.js +56 -0
- package/dist/server/collections/agent-harness-profiles.js +12 -0
- package/dist/server/collections/agent-loop-action-approvals.js +68 -0
- package/dist/server/collections/agent-loop-artifacts.js +55 -0
- package/dist/server/collections/agent-loop-circuit-states.js +53 -0
- package/dist/server/collections/agent-loop-control-settings.js +51 -0
- package/dist/server/collections/agent-loop-events.js +27 -0
- package/dist/server/collections/agent-loop-path-locks.js +57 -0
- package/dist/server/collections/agent-loop-patterns.js +72 -0
- package/dist/server/collections/agent-loop-runs.js +163 -2
- package/dist/server/collections/agent-loop-steps.js +69 -0
- package/dist/server/collections/agent-loop-usage-buckets.js +52 -0
- package/dist/server/collections/agent-loop-worktrees.js +55 -0
- package/dist/server/migrations/{20260427000000-change-packages-to-text.js → 20260427000002-change-packages-to-text.js} +2 -0
- package/dist/server/migrations/20260429000000-add-llm-fields.js +3 -2
- package/dist/server/migrations/{20260429000000-fix-inputargs-json-to-text.js → 20260429000001-fix-inputargs-json-to-text.js} +14 -6
- package/dist/server/migrations/20260503000000-add-orchestrator-trace-fields.js +2 -1
- package/dist/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.js +2 -1
- package/dist/server/migrations/20260803010000-backfill-loop-control-plane-data.js +262 -0
- package/dist/server/plugin.js +52 -150
- package/dist/server/resources/agent-loop-approval.js +83 -0
- package/dist/server/resources/agent-loop-artifact.js +86 -0
- package/dist/server/resources/agent-loop-events-stream.js +130 -0
- package/dist/server/resources/agent-loop.js +181 -139
- package/dist/server/resources/resource-helpers.js +63 -0
- package/dist/server/resources/tracing.js +121 -107
- package/dist/server/services/DurableCircuitBreakerService.js +229 -0
- package/dist/server/services/HarnessCompiler.js +142 -0
- package/dist/server/services/HarnessProfileService.js +168 -0
- package/dist/server/services/HarnessSchema.js +167 -0
- package/dist/server/services/LoopBudgetService.js +269 -0
- package/dist/server/services/LoopControlService.js +139 -0
- package/dist/server/services/LoopPatternSchema.js +180 -0
- package/dist/server/services/LoopPatternService.js +132 -0
- package/dist/server/services/LoopRunRepository.js +205 -0
- package/dist/server/services/LoopRunStateMachine.js +389 -0
- package/dist/server/services/LoopSchedulerService.js +193 -0
- package/dist/server/services/LoopTriggerService.js +128 -0
- package/dist/server/services/LoopWorkerService.js +461 -0
- package/dist/server/services/PathLockService.js +288 -0
- package/dist/server/services/PluginAiRuntimeAdapter.js +215 -0
- package/dist/server/services/VerificationSchema.js +59 -0
- package/dist/server/services/VerificationService.js +169 -0
- package/dist/server/skill-hub/actions/git-import.js +13 -7
- package/dist/server/skill-hub/services/RegistrySkillSnapshotService.js +1 -5
- package/dist/server/utils/ensure-indexes.js +111 -0
- package/dist/server/utils/loop-pattern-context.js +56 -0
- package/package.json +1 -1
- package/src/client/OrchestratorSettings.tsx +44 -0
- package/src/client-v2/components/AgentRunsTab.tsx +576 -494
- package/src/client-v2/components/HarnessProfilesTab.tsx +13 -8
- package/src/client-v2/components/MemoryInspectorTab.tsx +19 -3
- package/src/client-v2/components/TracingTab.tsx +515 -432
- package/src/client-v2/hooks/useApiRequest.ts +141 -121
- package/src/client-v2/skill-hub/components/SkillMetrics.tsx +8 -6
- package/src/locale/en-US.json +52 -28
- package/src/locale/vi-VN.json +52 -28
- package/src/locale/zh-CN.json +52 -28
- package/src/server/__tests__/circuit-breaker.test.ts +225 -146
- package/src/server/__tests__/harness-compiler.test.ts +131 -0
- package/src/server/__tests__/harness-profile-service.test.ts +116 -0
- package/src/server/__tests__/harness-tool-plan.test.ts +148 -0
- package/src/server/__tests__/loop-budget-service.test.ts +255 -0
- package/src/server/__tests__/loop-control-plane-backfill.test.ts +266 -0
- package/src/server/__tests__/loop-pattern-schema.test.ts +56 -0
- package/src/server/__tests__/loop-pattern-service.test.ts +148 -0
- package/src/server/__tests__/loop-run-state-machine.test.ts +90 -0
- package/src/server/__tests__/loop-worker-claim.test.ts +341 -0
- package/src/server/__tests__/loop-worker-execution.test.ts +236 -0
- package/src/server/__tests__/path-lock-service.test.ts +254 -0
- package/src/server/__tests__/smoke.test.ts +62 -21
- package/src/server/collections/agent-execution-spans.ts +47 -0
- package/src/server/collections/agent-harness-profile-versions.ts +26 -0
- package/src/server/collections/agent-harness-profiles.ts +12 -0
- package/src/server/collections/agent-loop-action-approvals.ts +38 -0
- package/src/server/collections/agent-loop-artifacts.ts +25 -0
- package/src/server/collections/agent-loop-circuit-states.ts +23 -0
- package/src/server/collections/agent-loop-control-settings.ts +21 -0
- package/src/server/collections/agent-loop-events.ts +27 -0
- package/src/server/collections/agent-loop-path-locks.ts +27 -0
- package/src/server/collections/agent-loop-patterns.ts +42 -0
- package/src/server/collections/agent-loop-runs.ts +163 -2
- package/src/server/collections/agent-loop-steps.ts +69 -0
- package/src/server/collections/agent-loop-usage-buckets.ts +22 -0
- package/src/server/collections/agent-loop-worktrees.ts +25 -0
- package/src/server/migrations/{20260427000000-change-packages-to-text.ts → 20260427000002-change-packages-to-text.ts} +3 -0
- package/src/server/migrations/20260429000000-add-llm-fields.ts +3 -2
- package/src/server/migrations/{20260429000000-fix-inputargs-json-to-text.ts → 20260429000001-fix-inputargs-json-to-text.ts} +13 -6
- package/src/server/migrations/20260503000000-add-orchestrator-trace-fields.ts +2 -1
- package/src/server/migrations/20260524000000-add-agent-loop-fields-to-skill-executions.ts +2 -1
- package/src/server/migrations/20260803010000-backfill-loop-control-plane-data.ts +293 -0
- package/src/server/plugin.ts +53 -167
- package/src/server/resources/agent-loop-approval.ts +52 -0
- package/src/server/resources/agent-loop-artifact.ts +56 -0
- package/src/server/resources/agent-loop-events-stream.ts +105 -0
- package/src/server/resources/agent-loop.ts +202 -143
- package/src/server/resources/agent-monitor.ts +482 -482
- package/src/server/resources/resource-helpers.ts +33 -0
- package/src/server/resources/tracing.ts +145 -137
- package/src/server/services/DurableCircuitBreakerService.ts +239 -0
- package/src/server/services/HarnessCompiler.ts +133 -0
- package/src/server/services/HarnessProfileService.ts +157 -0
- package/src/server/services/HarnessSchema.ts +163 -0
- package/src/server/services/LoopBudgetService.ts +275 -0
- package/src/server/services/LoopControlService.ts +124 -0
- package/src/server/services/LoopPatternSchema.ts +167 -0
- package/src/server/services/LoopPatternService.ts +143 -0
- package/src/server/services/LoopRunRepository.ts +237 -0
- package/src/server/services/LoopRunStateMachine.ts +432 -0
- package/src/server/services/LoopSchedulerService.ts +199 -0
- package/src/server/services/LoopTriggerService.ts +115 -0
- package/src/server/services/LoopWorkerService.ts +522 -0
- package/src/server/services/PathLockService.ts +321 -0
- package/src/server/services/PluginAiRuntimeAdapter.ts +315 -0
- package/src/server/services/VerificationSchema.ts +31 -0
- package/src/server/services/VerificationService.ts +185 -0
- package/src/server/skill-hub/actions/__tests__/git-import.test.ts +15 -1
- package/src/server/skill-hub/actions/git-import.ts +9 -3
- package/src/server/skill-hub/services/RegistrySkillSnapshotService.ts +1 -5
- package/src/server/skill-hub/services/__tests__/RegistrySkillSnapshotService.test.ts +1 -3
- package/src/server/utils/ensure-indexes.ts +96 -0
- package/src/server/utils/logging.ts +0 -1
- package/src/server/utils/loop-pattern-context.ts +20 -0
- package/dist/client-v2/214.79650a549273f163.js +0 -10
- package/dist/client-v2/253.9f0537713cee9e6c.js +0 -10
- package/dist/client-v2/264.718a107e43fc163c.js +0 -10
- package/dist/client-v2/418.ce8f5b2b8a229d1d.js +0 -10
- package/dist/client-v2/619.bd3c5698b40705c3.js +0 -10
- package/dist/client-v2/925.f5370de8f6632d65.js +0 -10
- package/dist/server/services/AgentHarness.js +0 -81
- package/dist/server/services/AgentLoopController.js +0 -1023
- package/dist/server/services/AgentLoopRepository.js +0 -192
- package/dist/server/services/AgentLoopService.js +0 -142
- package/dist/server/services/AgentPlanValidator.js +0 -99
- package/dist/server/services/AgentPlannerService.js +0 -99
- package/dist/server/services/CircuitBreaker.js +0 -125
- package/dist/server/services/ContextAggregator.js +0 -201
- package/dist/server/services/PlanningPromptService.js +0 -95
- package/dist/server/tools/agent-loop.js +0 -373
- package/dist/server/tools/orchestrator-plan.js +0 -254
- package/src/server/__tests__/agent-loop-controller.test.ts +0 -375
- package/src/server/__tests__/context-aggregator.test.ts +0 -222
- package/src/server/__tests__/parallel-execution.test.ts +0 -318
- package/src/server/__tests__/planning-prompt-service.test.ts +0 -23
- package/src/server/services/AgentHarness.ts +0 -67
- package/src/server/services/AgentLoopController.ts +0 -1263
- package/src/server/services/AgentLoopRepository.ts +0 -178
- package/src/server/services/AgentLoopService.ts +0 -177
- package/src/server/services/AgentPlanValidator.ts +0 -73
- package/src/server/services/AgentPlannerService.ts +0 -80
- package/src/server/services/CircuitBreaker.ts +0 -126
- package/src/server/services/ContextAggregator.ts +0 -239
- package/src/server/services/PlanningPromptService.ts +0 -72
- package/src/server/tools/agent-loop.ts +0 -360
- package/src/server/tools/orchestrator-plan.ts +0 -255
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import type { Database } from '@nocobase/database';
|
|
2
|
+
import type { Application } from '@nocobase/server';
|
|
3
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { compileHarness } from '../services/HarnessCompiler';
|
|
5
|
+
import type { CompiledHarness } from '../services/HarnessCompiler';
|
|
6
|
+
import { loopPatternPolicySchema } from '../services/LoopPatternSchema';
|
|
7
|
+
|
|
8
|
+
type Row = Record<string, unknown>;
|
|
9
|
+
|
|
10
|
+
type InvokeCall = {
|
|
11
|
+
username: string;
|
|
12
|
+
systemMessage: string;
|
|
13
|
+
prompt: string;
|
|
14
|
+
harness: CompiledHarness;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const invokeCalls: InvokeCall[] = [];
|
|
18
|
+
const verifyCalls: Array<{ makerSummary: string; makerUsernames: string[] }> = [];
|
|
19
|
+
let onInvoke: ((call: InvokeCall) => Promise<void>) | null = null;
|
|
20
|
+
|
|
21
|
+
vi.mock('../services/PluginAiRuntimeAdapter', () => ({
|
|
22
|
+
PluginAiRuntimeAdapter: class {
|
|
23
|
+
async createConversation() {
|
|
24
|
+
return 'session-1';
|
|
25
|
+
}
|
|
26
|
+
async invoke(input: InvokeCall) {
|
|
27
|
+
invokeCalls.push(input);
|
|
28
|
+
if (onInvoke) await onInvoke(input);
|
|
29
|
+
return { sessionId: 'session-1', messageId: 'message-1', interrupted: [], content: `${input.username} done` };
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
vi.mock('../services/VerificationService', () => ({
|
|
35
|
+
VerificationService: class {
|
|
36
|
+
async verifyAndFinalize(input: { makerSummary: string; makerUsernames: string[] }) {
|
|
37
|
+
verifyCalls.push({ makerSummary: input.makerSummary, makerUsernames: input.makerUsernames });
|
|
38
|
+
return { verdict: { verdict: 'pass' }, finalStatus: 'succeeded' as const };
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
const { LoopWorkerService } = await import('../services/LoopWorkerService');
|
|
44
|
+
|
|
45
|
+
class MemoryRepository {
|
|
46
|
+
private nextId = 1;
|
|
47
|
+
|
|
48
|
+
constructor(readonly rows: Row[] = []) {
|
|
49
|
+
this.nextId = rows.reduce((maximum, row) => Math.max(maximum, Number(row.id) || 0), 0) + 1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async find(options: Row = {}) {
|
|
53
|
+
const filter = (options.filter as Row | undefined) || {};
|
|
54
|
+
return this.rows.filter((row) => Object.entries(filter).every(([key, value]) => row[key] === value));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async findOne(options: Row) {
|
|
58
|
+
if (options.filterByTk !== undefined) return this.rows.find((row) => row.id === options.filterByTk) || null;
|
|
59
|
+
return (await this.find(options))[0] || null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async create(options: Row) {
|
|
63
|
+
const row = { id: this.nextId++, ...((options.values as Row | undefined) || {}) };
|
|
64
|
+
this.rows.push(row);
|
|
65
|
+
return row;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async update(options: Row) {
|
|
69
|
+
const values = (options.values as Row | undefined) || {};
|
|
70
|
+
for (const row of this.rows) {
|
|
71
|
+
if (row.id === options.filterByTk) Object.assign(row, values);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function harnessSnapshot(allow: string[]) {
|
|
77
|
+
return { effective: compileHarness([{ source: 'test', settings: { tools: { allow } } }]) };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const policy = loopPatternPolicySchema.parse({ maxConcurrency: 1 });
|
|
81
|
+
|
|
82
|
+
function createWorker(run: Row) {
|
|
83
|
+
const repositories = new Map<string, MemoryRepository>([
|
|
84
|
+
[
|
|
85
|
+
'agentLoopControlSettings',
|
|
86
|
+
new MemoryRepository([{ id: 1, key: 'global', state: 'running', acceptNewRuns: true, globalMaxConcurrency: 5 }]),
|
|
87
|
+
],
|
|
88
|
+
['agentLoopRuns', new MemoryRepository([{ ...run }])],
|
|
89
|
+
['agentLoopEvents', new MemoryRepository()],
|
|
90
|
+
['agentLoopSteps', new MemoryRepository()],
|
|
91
|
+
['agentLoopUsageBuckets', new MemoryRepository()],
|
|
92
|
+
['agentLoopCircuitStates', new MemoryRepository()],
|
|
93
|
+
['agentLoopPathLocks', new MemoryRepository()],
|
|
94
|
+
['agentLoopArtifacts', new MemoryRepository()],
|
|
95
|
+
]);
|
|
96
|
+
const database = {
|
|
97
|
+
getRepository(name: string) {
|
|
98
|
+
const repository = repositories.get(name);
|
|
99
|
+
if (!repository) throw new Error(`Unexpected repository ${name}`);
|
|
100
|
+
return repository;
|
|
101
|
+
},
|
|
102
|
+
sequelize: {
|
|
103
|
+
transaction<T>(callback: (value: { LOCK: { UPDATE: string } }) => Promise<T>) {
|
|
104
|
+
return callback({ LOCK: { UPDATE: 'UPDATE' } });
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
const app = {
|
|
109
|
+
name: 'test',
|
|
110
|
+
logger: { warn: vi.fn(), error: vi.fn(), info: vi.fn() },
|
|
111
|
+
log: { warn: vi.fn(), error: vi.fn(), info: vi.fn() },
|
|
112
|
+
lockManager: { runExclusive: <T>(_key: string, operation: () => Promise<T>) => operation() },
|
|
113
|
+
};
|
|
114
|
+
const worker = new LoopWorkerService(app as unknown as Application, database as unknown as Database);
|
|
115
|
+
return { repositories, worker: worker as unknown as WorkerInternals, service: worker };
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
type WorkerInternals = {
|
|
119
|
+
execute(claimed: { run: Row; leaseToken: string; leaseUntil: Date }): Promise<void>;
|
|
120
|
+
heartbeat(runId: number, leaseToken: string): Promise<void>;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
function claimedRun(run: Row) {
|
|
124
|
+
return { run, leaseToken: 'worker-a:lease', leaseUntil: new Date(Date.now() + 60_000) };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function baseRun(overrides: Row = {}) {
|
|
128
|
+
return {
|
|
129
|
+
id: 1,
|
|
130
|
+
runtimeVersion: 'control-plane-v2',
|
|
131
|
+
patternId: 1,
|
|
132
|
+
status: 'preparing',
|
|
133
|
+
lockedBy: 'worker-a:lease',
|
|
134
|
+
lockedUntil: new Date(Date.now() + 60_000),
|
|
135
|
+
goal: 'Ship the feature',
|
|
136
|
+
autonomyLevel: 'L1',
|
|
137
|
+
policySnapshot: policy,
|
|
138
|
+
roleBindingsSnapshot: { leader: 'lead', makers: ['maker-one', 'maker-two'], verifier: 'checker' },
|
|
139
|
+
leaderHarnessSnapshot: harnessSnapshot(['readFile']),
|
|
140
|
+
makerHarnessSnapshot: {
|
|
141
|
+
'maker-one': harnessSnapshot(['editFile']),
|
|
142
|
+
'maker-two': harnessSnapshot(['runTests']),
|
|
143
|
+
},
|
|
144
|
+
verifierHarnessSnapshot: harnessSnapshot(['readFile']),
|
|
145
|
+
repositoryKey: '',
|
|
146
|
+
actingOn: [],
|
|
147
|
+
...overrides,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
beforeEach(() => {
|
|
152
|
+
invokeCalls.length = 0;
|
|
153
|
+
verifyCalls.length = 0;
|
|
154
|
+
onInvoke = null;
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
describe('LoopWorkerService maker execution', () => {
|
|
158
|
+
it('invokes every maker with its own compiled harness snapshot', async () => {
|
|
159
|
+
const run = baseRun();
|
|
160
|
+
const { worker } = createWorker(run);
|
|
161
|
+
|
|
162
|
+
await worker.execute(claimedRun(run));
|
|
163
|
+
|
|
164
|
+
// Before the fix the worker went leader -> verifier and `makerHarnessSnapshot` was never read,
|
|
165
|
+
// so per-maker tool grants had no runtime effect at all.
|
|
166
|
+
expect(invokeCalls.map((call) => call.username)).toEqual(['lead', 'maker-one', 'maker-two']);
|
|
167
|
+
expect(invokeCalls[1].harness.tools.allow).toEqual(['editFile']);
|
|
168
|
+
expect(invokeCalls[2].harness.tools.allow).toEqual(['runTests']);
|
|
169
|
+
expect(invokeCalls[1].prompt).toContain('lead done');
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('aggregates every maker report into the summary handed to the verifier', async () => {
|
|
173
|
+
const run = baseRun();
|
|
174
|
+
const { worker } = createWorker(run);
|
|
175
|
+
|
|
176
|
+
await worker.execute(claimedRun(run));
|
|
177
|
+
|
|
178
|
+
expect(verifyCalls).toHaveLength(1);
|
|
179
|
+
expect(verifyCalls[0].makerUsernames).toEqual(['maker-one', 'maker-two']);
|
|
180
|
+
expect(verifyCalls[0].makerSummary).toContain('# maker-one');
|
|
181
|
+
expect(verifyCalls[0].makerSummary).toContain('# maker-two');
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('fails the run when a bound maker has no harness snapshot', async () => {
|
|
185
|
+
const run = baseRun({ makerHarnessSnapshot: { 'maker-one': harnessSnapshot(['editFile']) } });
|
|
186
|
+
const { repositories, worker } = createWorker(run);
|
|
187
|
+
|
|
188
|
+
await worker.execute(claimedRun(run));
|
|
189
|
+
|
|
190
|
+
// A missing snapshot must not silently skip the maker: that would run the loop with fewer
|
|
191
|
+
// participants than the pattern declared.
|
|
192
|
+
expect(repositories.get('agentLoopRuns')?.rows[0].status).toBe('failed');
|
|
193
|
+
expect(String(repositories.get('agentLoopRuns')?.rows[0].summary)).toContain('maker-two');
|
|
194
|
+
expect(verifyCalls).toHaveLength(0);
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
describe('LoopWorkerService path lock lifecycle', () => {
|
|
199
|
+
it('renews the path lock on the same beat as the worker lease', async () => {
|
|
200
|
+
const run = baseRun({ repositoryKey: 'repo', actingOn: ['src/a/**'] });
|
|
201
|
+
const { repositories, worker } = createWorker(run);
|
|
202
|
+
const renewedAt: Array<string | undefined> = [];
|
|
203
|
+
|
|
204
|
+
onInvoke = async () => {
|
|
205
|
+
const before = repositories.get('agentLoopPathLocks')?.rows[0];
|
|
206
|
+
await worker.heartbeat(1, 'worker-a:lease');
|
|
207
|
+
const after = repositories.get('agentLoopPathLocks')?.rows[0];
|
|
208
|
+
renewedAt.push(String(after?.expiresAt));
|
|
209
|
+
expect(String(after?.expiresAt)).not.toBe(String(before?.expiresAt));
|
|
210
|
+
onInvoke = null;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
await worker.execute(claimedRun(run));
|
|
214
|
+
|
|
215
|
+
// The lock TTL is longer than the lease, but a run can outlive it. Without renewal the lock
|
|
216
|
+
// lapses mid-run and another run becomes free to take the same paths.
|
|
217
|
+
expect(renewedAt).toHaveLength(1);
|
|
218
|
+
expect(repositories.get('agentLoopPathLocks')?.rows[0]).toMatchObject({ status: 'released' });
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it('releases only the lock this worker still owns', async () => {
|
|
222
|
+
const run = baseRun({ repositoryKey: 'repo', actingOn: ['src/a/**'] });
|
|
223
|
+
const { repositories, worker } = createWorker(run);
|
|
224
|
+
|
|
225
|
+
onInvoke = async () => {
|
|
226
|
+
// Another worker reclaimed the run and re-took the lock while this one was mid-invocation.
|
|
227
|
+
const lock = repositories.get('agentLoopPathLocks')?.rows[0];
|
|
228
|
+
if (lock) lock.owner = 'worker-b:lease';
|
|
229
|
+
onInvoke = null;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
await worker.execute(claimedRun(run));
|
|
233
|
+
|
|
234
|
+
expect(repositories.get('agentLoopPathLocks')?.rows[0]).toMatchObject({ status: 'held', owner: 'worker-b:lease' });
|
|
235
|
+
});
|
|
236
|
+
});
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import type { Database } from '@nocobase/database';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import {
|
|
4
|
+
PathLockService,
|
|
5
|
+
lockPathsOverlap,
|
|
6
|
+
normalizeLockPath,
|
|
7
|
+
pathSetsOverlap,
|
|
8
|
+
waitGraphHasCycle,
|
|
9
|
+
} from '../services/PathLockService';
|
|
10
|
+
|
|
11
|
+
type Row = Record<string, unknown>;
|
|
12
|
+
|
|
13
|
+
class MemoryRepository {
|
|
14
|
+
private nextId = 1;
|
|
15
|
+
|
|
16
|
+
constructor(readonly rows: Row[] = []) {}
|
|
17
|
+
|
|
18
|
+
async find(options: Row = {}) {
|
|
19
|
+
const filter = (options.filter as Row | undefined) || {};
|
|
20
|
+
return this.rows.filter((row) => Object.entries(filter).every(([key, value]) => row[key] === value));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async findOne(options: Row) {
|
|
24
|
+
if (options.filterByTk !== undefined) return this.rows.find((row) => row.id === options.filterByTk) || null;
|
|
25
|
+
return (await this.find(options))[0] || null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async create(options: Row) {
|
|
29
|
+
const row = { id: this.nextId++, ...((options.values as Row | undefined) || {}) };
|
|
30
|
+
this.rows.push(row);
|
|
31
|
+
return row;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async update(options: Row) {
|
|
35
|
+
const values = (options.values as Row | undefined) || {};
|
|
36
|
+
for (const row of this.rows) {
|
|
37
|
+
if (row.id === options.filterByTk) Object.assign(row, values);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function createService(rows: Row[] = []) {
|
|
43
|
+
const locks = new MemoryRepository(rows);
|
|
44
|
+
const database = {
|
|
45
|
+
getRepository(name: string) {
|
|
46
|
+
if (name !== 'agentLoopPathLocks') throw new Error(`Unexpected repository ${name}`);
|
|
47
|
+
return locks;
|
|
48
|
+
},
|
|
49
|
+
sequelize: {
|
|
50
|
+
// Writes made inside a transaction that throws must disappear, otherwise a test cannot tell
|
|
51
|
+
// an audit write that commits from one that is rolled back with the error that follows it.
|
|
52
|
+
async transaction<T>(callback: (value: { LOCK: { UPDATE: string } }) => Promise<T>) {
|
|
53
|
+
const snapshot = structuredClone(locks.rows);
|
|
54
|
+
try {
|
|
55
|
+
return await callback({ LOCK: { UPDATE: 'UPDATE' } });
|
|
56
|
+
} catch (error) {
|
|
57
|
+
locks.rows.splice(0, locks.rows.length, ...snapshot);
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
const distributedLock = { runExclusive: <T>(_key: string, operation: () => Promise<T>) => operation() };
|
|
64
|
+
return { locks, service: new PathLockService(database as unknown as Database, distributedLock) };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
describe('PathLockService primitives', () => {
|
|
68
|
+
it('compares repository paths by segment instead of string prefix', () => {
|
|
69
|
+
expect(lockPathsOverlap('src/a/**', 'src/a/tests/**')).toBe(true);
|
|
70
|
+
expect(lockPathsOverlap('src/a/**', 'src/ab/**')).toBe(false);
|
|
71
|
+
expect(lockPathsOverlap('packages/*/src/**', 'packages/plugin-a/src/file.ts')).toBe(true);
|
|
72
|
+
expect(pathSetsOverlap(['src/a/**', 'docs/**'], ['src/ab/**', 'tests/**'])).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('rejects paths outside the repository namespace', () => {
|
|
76
|
+
expect(() => normalizeLockPath('../secret')).toThrow('dot segments');
|
|
77
|
+
expect(() => normalizeLockPath('/absolute/path')).toThrow('repository-relative');
|
|
78
|
+
expect(() => normalizeLockPath('C:/absolute/path')).toThrow('repository-relative');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('detects waiter cycles without treating a normal wait chain as deadlock', () => {
|
|
82
|
+
const waiting = [
|
|
83
|
+
{
|
|
84
|
+
id: 1,
|
|
85
|
+
runId: 1,
|
|
86
|
+
repositoryKey: 'repo',
|
|
87
|
+
paths: ['src/a/**'],
|
|
88
|
+
status: 'waiting' as const,
|
|
89
|
+
blockerRunIds: [2],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 2,
|
|
93
|
+
runId: 2,
|
|
94
|
+
repositoryKey: 'repo',
|
|
95
|
+
paths: ['src/b/**'],
|
|
96
|
+
status: 'waiting' as const,
|
|
97
|
+
blockerRunIds: [3],
|
|
98
|
+
},
|
|
99
|
+
];
|
|
100
|
+
expect(waitGraphHasCycle(waiting, 3, [4])).toBe(false);
|
|
101
|
+
expect(waitGraphHasCycle(waiting, 3, [1])).toBe(true);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
describe('PathLockService TTL enforcement', () => {
|
|
106
|
+
it('expires a held lock past its TTL instead of treating it as a blocker', async () => {
|
|
107
|
+
const { locks, service } = createService([
|
|
108
|
+
{
|
|
109
|
+
id: 1,
|
|
110
|
+
runId: 1,
|
|
111
|
+
repositoryKey: 'repo',
|
|
112
|
+
owner: 'worker-dead',
|
|
113
|
+
paths: ['src/a/**'],
|
|
114
|
+
status: 'held',
|
|
115
|
+
blockerRunIds: [],
|
|
116
|
+
expiresAt: new Date(Date.now() - 1_000),
|
|
117
|
+
},
|
|
118
|
+
]);
|
|
119
|
+
|
|
120
|
+
const result = await service.acquire({
|
|
121
|
+
runId: 2,
|
|
122
|
+
repositoryKey: 'repo',
|
|
123
|
+
owner: 'worker-b',
|
|
124
|
+
paths: ['src/a/file.ts'],
|
|
125
|
+
ttlMs: 60_000,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
expect(result.acquired).toBe(true);
|
|
129
|
+
expect(locks.rows[0]).toMatchObject({ id: 1, status: 'expired' });
|
|
130
|
+
expect(locks.rows[1]).toMatchObject({ runId: 2, status: 'held', owner: 'worker-b' });
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('keeps an unexpired held lock as a blocker for an overlapping path', async () => {
|
|
134
|
+
const { locks, service } = createService([
|
|
135
|
+
{
|
|
136
|
+
id: 1,
|
|
137
|
+
runId: 1,
|
|
138
|
+
repositoryKey: 'repo',
|
|
139
|
+
owner: 'worker-a',
|
|
140
|
+
paths: ['src/a/**'],
|
|
141
|
+
status: 'held',
|
|
142
|
+
blockerRunIds: [],
|
|
143
|
+
expiresAt: new Date(Date.now() + 60_000),
|
|
144
|
+
},
|
|
145
|
+
]);
|
|
146
|
+
|
|
147
|
+
const result = await service.acquire({
|
|
148
|
+
runId: 2,
|
|
149
|
+
repositoryKey: 'repo',
|
|
150
|
+
owner: 'worker-b',
|
|
151
|
+
paths: ['src/a/file.ts'],
|
|
152
|
+
ttlMs: 60_000,
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
expect(result).toMatchObject({ acquired: false, deadlocked: false, blockers: [1] });
|
|
156
|
+
expect(locks.rows[0].status).toBe('held');
|
|
157
|
+
expect(locks.rows[1]).toMatchObject({ runId: 2, status: 'waiting', blockerRunIds: [1] });
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('refuses to renew a lock whose TTL already lapsed', async () => {
|
|
161
|
+
const { locks, service } = createService([
|
|
162
|
+
{
|
|
163
|
+
id: 1,
|
|
164
|
+
runId: 1,
|
|
165
|
+
repositoryKey: 'repo',
|
|
166
|
+
owner: 'worker-a',
|
|
167
|
+
paths: ['src/a/**'],
|
|
168
|
+
status: 'held',
|
|
169
|
+
blockerRunIds: [],
|
|
170
|
+
expiresAt: new Date(Date.now() - 1),
|
|
171
|
+
},
|
|
172
|
+
]);
|
|
173
|
+
|
|
174
|
+
await expect(service.renew(1, 'repo', 60_000, 'worker-a')).rejects.toThrow('expired');
|
|
175
|
+
// The `expired` mark must survive the error. It is only durable because the audit write commits
|
|
176
|
+
// in its own transaction; writing it in the transaction that throws would roll it back to `held`.
|
|
177
|
+
expect(locks.rows[0].status).toBe('expired');
|
|
178
|
+
expect(locks.rows[0].blockerRunIds).toEqual([]);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it('rejects a release from a worker that no longer owns the lock and keeps it held', async () => {
|
|
182
|
+
const { locks, service } = createService([
|
|
183
|
+
{
|
|
184
|
+
id: 1,
|
|
185
|
+
runId: 1,
|
|
186
|
+
repositoryKey: 'repo',
|
|
187
|
+
owner: 'worker-a',
|
|
188
|
+
paths: ['src/a/**'],
|
|
189
|
+
status: 'held',
|
|
190
|
+
blockerRunIds: [],
|
|
191
|
+
expiresAt: new Date(Date.now() + 60_000),
|
|
192
|
+
},
|
|
193
|
+
]);
|
|
194
|
+
|
|
195
|
+
// worker-b reclaimed the run and now owns the lock; the stale worker-a must not free it.
|
|
196
|
+
await expect(service.release(1, 'repo', 'worker-b')).resolves.toBe(false);
|
|
197
|
+
expect(locks.rows[0].status).toBe('held');
|
|
198
|
+
|
|
199
|
+
await expect(service.release(1, 'repo', 'worker-a')).resolves.toBe(true);
|
|
200
|
+
expect(locks.rows[0].status).toBe('released');
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it('rejects a renew from a worker that no longer owns the lock', async () => {
|
|
204
|
+
const { service } = createService([
|
|
205
|
+
{
|
|
206
|
+
id: 1,
|
|
207
|
+
runId: 1,
|
|
208
|
+
repositoryKey: 'repo',
|
|
209
|
+
owner: 'worker-a',
|
|
210
|
+
paths: ['src/a/**'],
|
|
211
|
+
status: 'held',
|
|
212
|
+
blockerRunIds: [],
|
|
213
|
+
expiresAt: new Date(Date.now() + 60_000),
|
|
214
|
+
},
|
|
215
|
+
]);
|
|
216
|
+
|
|
217
|
+
await expect(service.renew(1, 'repo', 60_000, 'worker-b')).rejects.toThrow('no longer owned');
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it('reuses an existing held lock only for the same owner and paths', async () => {
|
|
221
|
+
const { locks, service } = createService([
|
|
222
|
+
{
|
|
223
|
+
id: 1,
|
|
224
|
+
runId: 1,
|
|
225
|
+
repositoryKey: 'repo',
|
|
226
|
+
owner: 'worker-a',
|
|
227
|
+
paths: ['src/a/**'],
|
|
228
|
+
status: 'held',
|
|
229
|
+
blockerRunIds: [],
|
|
230
|
+
expiresAt: new Date(Date.now() + 60_000),
|
|
231
|
+
},
|
|
232
|
+
]);
|
|
233
|
+
|
|
234
|
+
await expect(
|
|
235
|
+
service.acquire({ runId: 1, repositoryKey: 'repo', owner: 'worker-a', paths: ['src/a/**'], ttlMs: 60_000 }),
|
|
236
|
+
).resolves.toMatchObject({ acquired: true });
|
|
237
|
+
expect(locks.rows).toHaveLength(1);
|
|
238
|
+
|
|
239
|
+
// A different owner token means the previous worker's lease is gone; the row is re-taken
|
|
240
|
+
// rather than silently shared.
|
|
241
|
+
await expect(
|
|
242
|
+
service.acquire({ runId: 1, repositoryKey: 'repo', owner: 'worker-b', paths: ['src/a/**'], ttlMs: 60_000 }),
|
|
243
|
+
).resolves.toMatchObject({ acquired: true });
|
|
244
|
+
expect(locks.rows).toHaveLength(1);
|
|
245
|
+
expect(locks.rows[0].owner).toBe('worker-b');
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
it('rejects a non-positive TTL', async () => {
|
|
249
|
+
const { service } = createService();
|
|
250
|
+
await expect(
|
|
251
|
+
service.acquire({ runId: 1, repositoryKey: 'repo', owner: 'worker-a', paths: ['src/a/**'], ttlMs: 0 }),
|
|
252
|
+
).rejects.toThrow('positive number of milliseconds');
|
|
253
|
+
});
|
|
254
|
+
});
|
|
@@ -1,23 +1,37 @@
|
|
|
1
|
-
import { createMockServer } from '@nocobase/test';
|
|
1
|
+
import { createMockServer, MockServer } from '@nocobase/test';
|
|
2
|
+
import { PluginAgentOrchestratorServer } from '../plugin';
|
|
3
|
+
import { ensureAgentOrchestratorIndexes } from '../utils/ensure-indexes';
|
|
4
|
+
|
|
5
|
+
type DatabaseIndex = {
|
|
6
|
+
name?: string;
|
|
7
|
+
unique?: boolean;
|
|
8
|
+
fields?: Array<{ attribute?: string; name?: string }>;
|
|
9
|
+
};
|
|
2
10
|
|
|
3
11
|
describe('Agent Orchestrator plugin smoke', () => {
|
|
4
|
-
let app;
|
|
12
|
+
let app: MockServer;
|
|
5
13
|
|
|
6
|
-
|
|
14
|
+
beforeAll(async () => {
|
|
15
|
+
const createdApp = await createMockServer({
|
|
16
|
+
plugins: ['nocobase', PluginAgentOrchestratorServer],
|
|
17
|
+
name: `agent-orchestrator-smoke-${process.pid}`,
|
|
18
|
+
skipSupervisor: true,
|
|
19
|
+
beforeInstall: async (mockApp) => {
|
|
20
|
+
app = mockApp;
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
app = createdApp;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
afterAll(async () => {
|
|
7
27
|
await app?.destroy();
|
|
8
28
|
});
|
|
9
29
|
|
|
10
30
|
it('loads without starting the full app', async () => {
|
|
11
|
-
app = await createMockServer({
|
|
12
|
-
plugins: ['nocobase', 'plugin-agent-orchestrator'],
|
|
13
|
-
});
|
|
14
31
|
expect(app).toBeTruthy();
|
|
15
32
|
});
|
|
16
33
|
|
|
17
34
|
it('registers collection definitions', async () => {
|
|
18
|
-
app = await createMockServer({
|
|
19
|
-
plugins: ['nocobase', 'plugin-agent-orchestrator'],
|
|
20
|
-
});
|
|
21
35
|
const collections = [
|
|
22
36
|
'agentLoopRuns',
|
|
23
37
|
'agentLoopSteps',
|
|
@@ -27,6 +41,15 @@ describe('Agent Orchestrator plugin smoke', () => {
|
|
|
27
41
|
'agentExecutionSpans',
|
|
28
42
|
'agentMemoryContexts',
|
|
29
43
|
'agentHarnessProfiles',
|
|
44
|
+
'agentHarnessProfileVersions',
|
|
45
|
+
'agentLoopPatterns',
|
|
46
|
+
'agentLoopActionApprovals',
|
|
47
|
+
'agentLoopArtifacts',
|
|
48
|
+
'agentLoopWorktrees',
|
|
49
|
+
'agentLoopPathLocks',
|
|
50
|
+
'agentLoopCircuitStates',
|
|
51
|
+
'agentLoopUsageBuckets',
|
|
52
|
+
'agentLoopControlSettings',
|
|
30
53
|
'skillDefinitions',
|
|
31
54
|
'skillExecutions',
|
|
32
55
|
'skillLoopConfigs',
|
|
@@ -38,16 +61,19 @@ describe('Agent Orchestrator plugin smoke', () => {
|
|
|
38
61
|
}
|
|
39
62
|
});
|
|
40
63
|
|
|
41
|
-
it('has agentLoopRuns schema with required fields', async () => {
|
|
42
|
-
app = await createMockServer({
|
|
43
|
-
plugins: ['nocobase', 'plugin-agent-orchestrator'],
|
|
44
|
-
});
|
|
64
|
+
it('has agentLoopRuns schema with required fields and indexes', async () => {
|
|
45
65
|
const collection = app.db.getCollection('agentLoopRuns');
|
|
46
66
|
expect(collection).toBeTruthy();
|
|
47
67
|
|
|
48
68
|
const fields = {
|
|
49
69
|
goal: 'text',
|
|
50
70
|
status: 'string',
|
|
71
|
+
runtimeVersion: 'string',
|
|
72
|
+
recordMode: 'string',
|
|
73
|
+
patternId: 'bigInt',
|
|
74
|
+
pattern: 'belongsTo',
|
|
75
|
+
userId: 'bigInt',
|
|
76
|
+
policySnapshot: 'json',
|
|
51
77
|
planVersion: 'integer',
|
|
52
78
|
iterationCount: 'integer',
|
|
53
79
|
totalTokens: 'integer',
|
|
@@ -59,30 +85,45 @@ describe('Agent Orchestrator plugin smoke', () => {
|
|
|
59
85
|
expect(field).toBeTruthy();
|
|
60
86
|
expect(field.type).toBe(type);
|
|
61
87
|
}
|
|
88
|
+
|
|
89
|
+
await ensureAgentOrchestratorIndexes(app.db);
|
|
90
|
+
await ensureAgentOrchestratorIndexes(app.db);
|
|
91
|
+
|
|
92
|
+
const indexes = (await app.db.sequelize
|
|
93
|
+
.getQueryInterface()
|
|
94
|
+
.showIndex(collection.getTableNameWithSchema())) as DatabaseIndex[];
|
|
95
|
+
const fieldNames = (index: DatabaseIndex) => index.fields?.map((field) => field.attribute || field.name).join(',');
|
|
96
|
+
|
|
97
|
+
expect(indexes.some((index) => fieldNames(index) === 'userId,status')).toBe(true);
|
|
98
|
+
expect(
|
|
99
|
+
indexes.some(
|
|
100
|
+
(index) =>
|
|
101
|
+
index.name === 'agent_loop_runs_pattern_id_trigger_key' &&
|
|
102
|
+
index.unique === true &&
|
|
103
|
+
fieldNames(index) === 'patternId,triggerKey',
|
|
104
|
+
),
|
|
105
|
+
).toBe(true);
|
|
106
|
+
|
|
107
|
+
const indexNames = indexes.flatMap((index) => (index.name ? [index.name] : []));
|
|
108
|
+
expect(new Set(indexNames).size).toBe(indexNames.length);
|
|
62
109
|
});
|
|
63
110
|
|
|
64
111
|
it('can create an agentLoopRun record', async () => {
|
|
65
|
-
app = await createMockServer({
|
|
66
|
-
plugins: ['nocobase', 'plugin-agent-orchestrator'],
|
|
67
|
-
});
|
|
68
112
|
const repo = app.db.getRepository('agentLoopRuns');
|
|
69
113
|
const run = await repo.create({
|
|
70
114
|
values: {
|
|
71
115
|
rootRunId: 'test-root',
|
|
72
116
|
goal: 'Test goal',
|
|
73
|
-
status: '
|
|
117
|
+
status: 'queued',
|
|
74
118
|
},
|
|
75
119
|
});
|
|
76
120
|
expect(run.id).toBeTruthy();
|
|
77
121
|
expect(run.goal).toBe('Test goal');
|
|
78
|
-
expect(run.status).toBe('
|
|
122
|
+
expect(run.status).toBe('queued');
|
|
79
123
|
expect(run.rootRunId).toBe('test-root');
|
|
80
124
|
});
|
|
81
125
|
|
|
82
126
|
it('can create agentLoopSteps with parent-child relationship', async () => {
|
|
83
|
-
app = await createMockServer({
|
|
84
|
-
plugins: ['nocobase', 'plugin-agent-orchestrator'],
|
|
85
|
-
});
|
|
86
127
|
const runRepo = app.db.getRepository('agentLoopRuns');
|
|
87
128
|
const stepRepo = app.db.getRepository('agentLoopSteps');
|
|
88
129
|
|
|
@@ -23,6 +23,41 @@ export default defineCollection({
|
|
|
23
23
|
length: 100,
|
|
24
24
|
allowNull: false,
|
|
25
25
|
},
|
|
26
|
+
{
|
|
27
|
+
name: 'agentLoopRunId',
|
|
28
|
+
type: 'bigInt',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'agentLoopStepId',
|
|
32
|
+
type: 'bigInt',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'patternId',
|
|
36
|
+
type: 'bigInt',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'role',
|
|
40
|
+
type: 'string',
|
|
41
|
+
length: 30,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'harnessProfileTag',
|
|
45
|
+
type: 'string',
|
|
46
|
+
length: 100,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'harnessProfileVersion',
|
|
50
|
+
type: 'integer',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'policyDecision',
|
|
54
|
+
type: 'json',
|
|
55
|
+
defaultValue: {},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'approvalId',
|
|
59
|
+
type: 'bigInt',
|
|
60
|
+
},
|
|
26
61
|
{
|
|
27
62
|
name: 'parentSpanId',
|
|
28
63
|
type: 'string',
|
|
@@ -186,5 +221,17 @@ export default defineCollection({
|
|
|
186
221
|
{
|
|
187
222
|
fields: ['userId'],
|
|
188
223
|
},
|
|
224
|
+
{
|
|
225
|
+
fields: ['agentLoopRunId'],
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
fields: ['agentLoopStepId'],
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
fields: ['patternId'],
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
fields: ['approvalId'],
|
|
235
|
+
},
|
|
189
236
|
],
|
|
190
237
|
});
|