@tacitai/mcp-server 0.6.28 → 0.6.29
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.d.ts +10 -0
- package/dist/client.js +71 -0
- package/dist/flags.d.ts +11 -0
- package/dist/flags.js +33 -0
- package/dist/index.js +75 -4
- package/dist/prompts.d.ts +55 -0
- package/dist/prompts.js +26 -0
- package/dist/templates/role-loader.d.ts +9 -0
- package/dist/templates/role-loader.js +93 -0
- package/dist/tools/agents.d.ts +27 -4
- package/dist/tools/agents.js +110 -10
- package/dist/tools/cmo.d.ts +14 -0
- package/dist/tools/cmo.js +125 -0
- package/dist/tools/errors.js +4 -2
- package/dist/tools/outbox.d.ts +2 -2
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.js +14 -3
- package/dist/tools/workflow-prereqs.d.ts +16 -0
- package/dist/tools/workflow-prereqs.js +29 -0
- package/dist/tools/workflow-types.d.ts +11 -0
- package/dist/tools/workflow-types.js +179 -0
- package/dist/tools/workflow.d.ts +9 -0
- package/dist/tools/workflow.js +134 -0
- package/dist/workflow-gate.d.ts +173 -78
- package/dist/workflow-gate.js +741 -156
- package/dist/workflow-persistence.d.ts +25 -0
- package/dist/workflow-persistence.js +127 -0
- package/dist/workflow-registry.d.ts +80 -0
- package/dist/workflow-registry.js +375 -0
- package/dist/workflow-type-schema.d.ts +11 -0
- package/dist/workflow-type-schema.js +92 -0
- package/package.json +2 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow lifecycle MCP tools (MV-1539 W2 Step 6, W3 Step 11).
|
|
3
|
+
*
|
|
4
|
+
* W2: tacit_workflow_start, tacit_workflow_handoff, tacit_workflow_deactivate.
|
|
5
|
+
* W3: tacit_workflow_advance, tacit_workflow_resume, tacit_workflow_set_metadata.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { getRequestPrincipal } from '../client.js';
|
|
9
|
+
import { isWorkflowTypeActive } from '../flags.js';
|
|
10
|
+
const startSchema = z.object({
|
|
11
|
+
typeName: z.string().describe('The workflow type to start (e.g. cos_coordination, pyr_exec)'),
|
|
12
|
+
metadata: z.record(z.unknown()).optional().describe('Optional metadata for the workflow instance'),
|
|
13
|
+
});
|
|
14
|
+
const handoffSchema = z.object({
|
|
15
|
+
fromInstanceId: z.string().describe('The instance ID of the source workflow'),
|
|
16
|
+
targetTypeName: z.string().describe('The workflow type to hand off to'),
|
|
17
|
+
});
|
|
18
|
+
const deactivateSchema = z.object({
|
|
19
|
+
instanceId: z.string().describe('The instance ID to deactivate'),
|
|
20
|
+
});
|
|
21
|
+
const advanceSchema = z.object({
|
|
22
|
+
instanceId: z.string().describe('The instance ID whose phase to advance'),
|
|
23
|
+
});
|
|
24
|
+
const resumeSchema = z.object({
|
|
25
|
+
instanceId: z.string().describe('The instance ID to resume'),
|
|
26
|
+
approval: z.boolean().optional().describe('If true, sets phaseApproved before resuming'),
|
|
27
|
+
metadata: z.record(z.unknown()).optional().describe('Metadata to merge into the instance'),
|
|
28
|
+
});
|
|
29
|
+
const setMetadataSchema = z.object({
|
|
30
|
+
instanceId: z.string().describe('The instance ID to update metadata on'),
|
|
31
|
+
key: z.string().describe('The metadata key'),
|
|
32
|
+
value: z.unknown().describe('The metadata value'),
|
|
33
|
+
});
|
|
34
|
+
function jsonResult(data, isError = false) {
|
|
35
|
+
return {
|
|
36
|
+
content: [{ type: 'text', text: JSON.stringify(data) }],
|
|
37
|
+
isError,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function registerWorkflowTools(server, gate) {
|
|
41
|
+
server.tool('tacit_workflow_start', 'Start a new workflow instance of the given type. Returns the instance ID.', startSchema.shape, async (args) => {
|
|
42
|
+
const parsed = startSchema.safeParse(args);
|
|
43
|
+
if (!parsed.success) {
|
|
44
|
+
return jsonResult({ error: 'invalid_input', detail: parsed.error.message }, true);
|
|
45
|
+
}
|
|
46
|
+
const { typeName, metadata } = parsed.data;
|
|
47
|
+
if (!gate.getRegistry().has(typeName)) {
|
|
48
|
+
return jsonResult({ error: 'type_not_found', detail: `Unknown workflow type: ${typeName}` }, true);
|
|
49
|
+
}
|
|
50
|
+
if (!isWorkflowTypeActive(typeName)) {
|
|
51
|
+
return jsonResult({ error: 'type_not_active', detail: `Workflow type ${typeName} is disabled by feature flag` }, true);
|
|
52
|
+
}
|
|
53
|
+
const principal = getRequestPrincipal();
|
|
54
|
+
const instance = gate.startWorkflowTyped(principal, typeName, { metadata });
|
|
55
|
+
return jsonResult({
|
|
56
|
+
instanceId: instance.instanceId,
|
|
57
|
+
typeName: instance.typeRef,
|
|
58
|
+
active: instance.active,
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
server.tool('tacit_workflow_handoff', 'Hand off from one workflow instance to a target workflow type. Validates targetTypes.', handoffSchema.shape, async (args) => {
|
|
62
|
+
const parsed = handoffSchema.safeParse(args);
|
|
63
|
+
if (!parsed.success) {
|
|
64
|
+
return jsonResult({ error: 'invalid_input', detail: parsed.error.message }, true);
|
|
65
|
+
}
|
|
66
|
+
const { fromInstanceId, targetTypeName } = parsed.data;
|
|
67
|
+
if (!isWorkflowTypeActive(targetTypeName)) {
|
|
68
|
+
return jsonResult({ error: 'type_not_active', detail: `Target type ${targetTypeName} is disabled by feature flag` }, true);
|
|
69
|
+
}
|
|
70
|
+
const principal = getRequestPrincipal();
|
|
71
|
+
const result = gate.handoff(principal, fromInstanceId, targetTypeName);
|
|
72
|
+
if ('error' in result) {
|
|
73
|
+
return jsonResult(result, true);
|
|
74
|
+
}
|
|
75
|
+
return jsonResult({
|
|
76
|
+
instanceId: result.instanceId,
|
|
77
|
+
typeName: result.typeRef,
|
|
78
|
+
parentInstanceId: result.parentInstanceId,
|
|
79
|
+
active: result.active,
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
server.tool('tacit_workflow_deactivate', 'Deactivate a workflow instance by ID.', deactivateSchema.shape, async (args) => {
|
|
83
|
+
const parsed = deactivateSchema.safeParse(args);
|
|
84
|
+
if (!parsed.success) {
|
|
85
|
+
return jsonResult({ error: 'invalid_input', detail: parsed.error.message }, true);
|
|
86
|
+
}
|
|
87
|
+
const { instanceId } = parsed.data;
|
|
88
|
+
const principal = getRequestPrincipal();
|
|
89
|
+
const ok = gate.deactivateWorkflow(principal, instanceId);
|
|
90
|
+
if (!ok) {
|
|
91
|
+
return jsonResult({ error: 'instance_not_found', detail: `Instance ${instanceId} not found` }, true);
|
|
92
|
+
}
|
|
93
|
+
return jsonResult({ deactivated: true, instanceId });
|
|
94
|
+
});
|
|
95
|
+
// ── W3 Step 11: Phase engine tools ────────────────────────────────────────
|
|
96
|
+
server.tool('tacit_workflow_advance', 'Advance the current phase of a workflow instance. Checks required tools and approval gates.', advanceSchema.shape, async (args) => {
|
|
97
|
+
const parsed = advanceSchema.safeParse(args);
|
|
98
|
+
if (!parsed.success) {
|
|
99
|
+
return jsonResult({ error: 'invalid_input', detail: parsed.error.message }, true);
|
|
100
|
+
}
|
|
101
|
+
const principal = getRequestPrincipal();
|
|
102
|
+
const result = gate.advancePhase(principal, parsed.data.instanceId);
|
|
103
|
+
if ('error' in result) {
|
|
104
|
+
return jsonResult(result, true);
|
|
105
|
+
}
|
|
106
|
+
return jsonResult(result);
|
|
107
|
+
});
|
|
108
|
+
server.tool('tacit_workflow_resume', 'Resume a paused workflow instance. Optionally sets approval and merges metadata.', resumeSchema.shape, async (args) => {
|
|
109
|
+
const parsed = resumeSchema.safeParse(args);
|
|
110
|
+
if (!parsed.success) {
|
|
111
|
+
return jsonResult({ error: 'invalid_input', detail: parsed.error.message }, true);
|
|
112
|
+
}
|
|
113
|
+
const { instanceId, approval, metadata } = parsed.data;
|
|
114
|
+
const principal = getRequestPrincipal();
|
|
115
|
+
const result = gate.resumeWorkflow(principal, instanceId, { approval, metadata });
|
|
116
|
+
if ('error' in result) {
|
|
117
|
+
return jsonResult(result, true);
|
|
118
|
+
}
|
|
119
|
+
return jsonResult({ resumed: result.resumed, instanceId: result.instanceId, resumeMode: result.resumeMode });
|
|
120
|
+
});
|
|
121
|
+
server.tool('tacit_workflow_set_metadata', 'Set a metadata key-value pair on a workflow instance.', setMetadataSchema.shape, async (args) => {
|
|
122
|
+
const parsed = setMetadataSchema.safeParse(args);
|
|
123
|
+
if (!parsed.success) {
|
|
124
|
+
return jsonResult({ error: 'invalid_input', detail: parsed.error.message }, true);
|
|
125
|
+
}
|
|
126
|
+
const { instanceId, key, value } = parsed.data;
|
|
127
|
+
const principal = getRequestPrincipal();
|
|
128
|
+
const result = gate.setInstanceMetadata(principal, instanceId, key, value);
|
|
129
|
+
if ('error' in result) {
|
|
130
|
+
return jsonResult(result, true);
|
|
131
|
+
}
|
|
132
|
+
return jsonResult(result);
|
|
133
|
+
});
|
|
134
|
+
}
|
package/dist/workflow-gate.d.ts
CHANGED
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* WorkflowGate — Layer 1 server-side workflow enforcement (FEAT-249).
|
|
2
|
+
* WorkflowGate — Layer 1 server-side workflow enforcement (FEAT-249, MV-1539).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* Standalone KB promotion (SOP-03, no active workflow) stays ungated.
|
|
4
|
+
* Instance-isolated state: `Map<principal, Map<instanceId, WorkflowInstance>>`.
|
|
5
|
+
* Type-scoped supersession (Axiom 3): starting a workflow of type T supersedes any
|
|
6
|
+
* existing instance of T for the same principal (types with maxInstances > 1 coexist
|
|
7
|
+
* up to their limit). Legacy 2-arg methods resolve to the principal's
|
|
8
|
+
* `gm_content_placement` instance for backwards compatibility.
|
|
10
9
|
*
|
|
11
|
-
* Scoping (AC-isolation): one
|
|
10
|
+
* Scoping (AC-isolation): one gate per server process. State is keyed by caller
|
|
12
11
|
* principal — on the HTTP transport `getRequestPrincipal()` returns the bearer-token
|
|
13
12
|
* principal (AsyncLocalStorage); on stdio it returns null and every call shares the
|
|
14
|
-
* single '__stdio__' slot
|
|
15
|
-
* NEVER store gate state inside the per-request AsyncLocalStorage context: it would
|
|
16
|
-
* evaporate between HTTP requests and silently no-op the gate.
|
|
17
|
-
*
|
|
18
|
-
* Lifecycle: active from `tacit_gm_ingest` (which supersedes any prior workflow) until
|
|
19
|
-
* the FINAL placement completes — approve for pyramid, promote of the workflow's own
|
|
20
|
-
* artifact for KB (a promote of a DIFFERENT artifact is placement-unrelated and neither
|
|
21
|
-
* gated nor completing). `cross_reference` keeps the workflow active for a second
|
|
22
|
-
* placement cycle. `tacit_gm_reset` clears the call log and rearms ACTIVE whether or
|
|
23
|
-
* not a placement had completed. Nothing persists across process restarts.
|
|
13
|
+
* single '__stdio__' slot.
|
|
24
14
|
*/
|
|
15
|
+
import { WorkflowRegistry } from './workflow-registry.js';
|
|
16
|
+
import { type AutonomyLevel as _AutonomyLevel } from './client.js';
|
|
25
17
|
export interface GateVerdict {
|
|
26
18
|
allowed: boolean;
|
|
27
19
|
missing: string[];
|
|
28
20
|
message?: string;
|
|
21
|
+
prereqChain?: string[];
|
|
22
|
+
completed?: string[];
|
|
23
|
+
workflowType?: string;
|
|
24
|
+
currentPhase?: string;
|
|
25
|
+
userMessage?: string;
|
|
29
26
|
}
|
|
30
27
|
export interface WorkflowSnapshot {
|
|
31
28
|
active: boolean;
|
|
@@ -34,86 +31,184 @@ export interface WorkflowSnapshot {
|
|
|
34
31
|
crossReference: boolean;
|
|
35
32
|
placementsRemaining: number;
|
|
36
33
|
}
|
|
37
|
-
|
|
34
|
+
export type { _AutonomyLevel as AutonomyLevel };
|
|
35
|
+
type AutonomyLevel = _AutonomyLevel;
|
|
36
|
+
export interface WorkflowInstance {
|
|
37
|
+
instanceId: string;
|
|
38
|
+
typeRef: string;
|
|
39
|
+
workspaceId: string;
|
|
40
|
+
active: boolean;
|
|
41
|
+
artifactId: string | null;
|
|
42
|
+
catalogId: string | null;
|
|
43
|
+
crossReference: boolean;
|
|
44
|
+
placementsRemaining: number;
|
|
45
|
+
callLog: Map<string, number>;
|
|
46
|
+
fastTrackValidated: boolean;
|
|
47
|
+
lastPlacementKey: string | null;
|
|
48
|
+
metadata: Record<string, unknown>;
|
|
49
|
+
currentPhase: number;
|
|
50
|
+
paused: boolean;
|
|
51
|
+
phaseApproved: boolean;
|
|
52
|
+
parentInstanceId: string | null;
|
|
53
|
+
handoffCount: number;
|
|
54
|
+
createdAt: number;
|
|
55
|
+
lastActivityAt: number;
|
|
56
|
+
}
|
|
57
|
+
export interface WorkflowPersistencePort {
|
|
58
|
+
save(principal: string, workspaceId: string, instance: WorkflowInstance): Promise<void>;
|
|
59
|
+
restore(principal: string, workspaceId: string): Promise<WorkflowInstance[]>;
|
|
60
|
+
remove(principal: string, instanceId: string): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
export interface WorkflowChronicleEvent {
|
|
63
|
+
eventType: 'workflow.instance.created' | 'workflow.instance.deactivated' | 'workflow.instance.evicted' | 'workflow.phase.advanced' | 'workflow.phase.paused' | 'workflow.phase.resumed' | 'workflow.handoff.initiated' | 'workflow.handoff.completed';
|
|
64
|
+
instanceId: string;
|
|
65
|
+
typeName: string;
|
|
66
|
+
principal: string;
|
|
67
|
+
workspaceId: string;
|
|
68
|
+
timestamp: string;
|
|
69
|
+
metadata: Record<string, unknown>;
|
|
70
|
+
}
|
|
71
|
+
export interface WorkflowGateOpts {
|
|
72
|
+
registry: WorkflowRegistry;
|
|
73
|
+
maxPrincipals?: number;
|
|
74
|
+
maxTotalInstances?: number;
|
|
75
|
+
maxInstancesPerPrincipal?: number;
|
|
76
|
+
onEvent?: (event: WorkflowChronicleEvent) => void;
|
|
77
|
+
persistence?: WorkflowPersistencePort;
|
|
78
|
+
autonomyResolver?: (principal: string) => AutonomyLevel;
|
|
79
|
+
}
|
|
80
|
+
export interface StartWorkflowOpts {
|
|
81
|
+
artifactId?: string;
|
|
82
|
+
catalogId?: string;
|
|
83
|
+
crossReference?: boolean;
|
|
84
|
+
workspaceId?: string;
|
|
85
|
+
metadata?: Record<string, unknown>;
|
|
86
|
+
}
|
|
87
|
+
export interface WorkflowGateContext {
|
|
88
|
+
states: Map<string, Map<string, WorkflowInstance>>;
|
|
89
|
+
registry: WorkflowRegistry;
|
|
90
|
+
persistence?: WorkflowPersistencePort;
|
|
91
|
+
onEvent: (event: WorkflowChronicleEvent) => void;
|
|
92
|
+
getCachedAutonomy: (principal: string) => AutonomyLevel | null;
|
|
93
|
+
startWorkflow: (principal: string | null, typeName: string, opts?: StartWorkflowOpts) => WorkflowInstance;
|
|
94
|
+
keyOf: (principal: string | null) => string;
|
|
95
|
+
maxInstancesPerPrincipal: number;
|
|
96
|
+
maxTotalInstances: number;
|
|
97
|
+
}
|
|
98
|
+
/** Re-export from workflow-registry.ts (canonical source) for backwards compatibility. */
|
|
38
99
|
export declare const PYRAMID_PREREQ_TOOLS: readonly ["tacit_pyramid_list_portfolios", "tacit_pyramid_list_value_streams", "tacit_pyramid_list_programs", "tacit_pyramid_list_dossiers"];
|
|
39
|
-
/** Drill-down tool required before a GM-workflow KB promotion. */
|
|
40
100
|
export declare const KB_PREREQ_TOOL = "tacit_kb_list_collections";
|
|
41
101
|
export declare class WorkflowGate {
|
|
102
|
+
private readonly registry;
|
|
42
103
|
private readonly maxPrincipals;
|
|
104
|
+
private readonly maxTotalInstances;
|
|
105
|
+
private readonly maxInstancesPerPrincipal;
|
|
106
|
+
private readonly onEvent;
|
|
107
|
+
private readonly persistencePort?;
|
|
108
|
+
private readonly autonomyResolver?;
|
|
109
|
+
private readonly states;
|
|
110
|
+
private totalInstances;
|
|
111
|
+
private readonly restoredPrincipals;
|
|
112
|
+
private readonly principalMutex;
|
|
113
|
+
constructor(maxPrincipalsOrOpts?: number | WorkflowGateOpts);
|
|
114
|
+
getRegistry(): WorkflowRegistry;
|
|
115
|
+
keyOf(principal: string | null): string;
|
|
116
|
+
getCachedAutonomy(principal: string): AutonomyLevel | null;
|
|
117
|
+
ensureRestored(principal: string | null, workspaceId: string): Promise<void>;
|
|
118
|
+
checkToolAutonomy(principal: string | null, toolName: string): {
|
|
119
|
+
error: string;
|
|
120
|
+
required: AutonomyLevel;
|
|
121
|
+
current: AutonomyLevel;
|
|
122
|
+
} | null;
|
|
123
|
+
private ensurePrincipalMap;
|
|
124
|
+
private findGmInstance;
|
|
125
|
+
private findOrCreateGmInstance;
|
|
126
|
+
private emitEvent;
|
|
127
|
+
startWorkflowTyped(principal: string | null, typeName: string, opts?: StartWorkflowOpts): WorkflowInstance;
|
|
128
|
+
getInstance(principal: string | null, instanceId: string): WorkflowInstance | undefined;
|
|
129
|
+
getInstancesByType(principal: string | null, typeName: string): WorkflowInstance[];
|
|
130
|
+
deactivateWorkflow(principal: string | null, instanceId: string): boolean;
|
|
131
|
+
private evictOldestGlobal;
|
|
132
|
+
handoff(principal: string | null, fromInstanceId: string, targetTypeName: string, opts?: StartWorkflowOpts): WorkflowInstance | {
|
|
133
|
+
error: string;
|
|
134
|
+
detail?: string;
|
|
135
|
+
};
|
|
136
|
+
advancePhase(principal: string | null, instanceId: string): {
|
|
137
|
+
phase: string;
|
|
138
|
+
guidance: string;
|
|
139
|
+
} | {
|
|
140
|
+
completed: true;
|
|
141
|
+
instanceId: string;
|
|
142
|
+
} | {
|
|
143
|
+
error: string;
|
|
144
|
+
missing?: string[];
|
|
145
|
+
detail?: string;
|
|
146
|
+
};
|
|
147
|
+
resumeWorkflow(principal: string | null, instanceId: string, opts?: {
|
|
148
|
+
approval?: boolean;
|
|
149
|
+
metadata?: Record<string, unknown>;
|
|
150
|
+
}): {
|
|
151
|
+
resumed: true;
|
|
152
|
+
instanceId: string;
|
|
153
|
+
resumeMode: 'tool' | 'skill-preamble';
|
|
154
|
+
} | {
|
|
155
|
+
error: string;
|
|
156
|
+
detail?: string;
|
|
157
|
+
};
|
|
158
|
+
setInstanceMetadata(principal: string | null, instanceId: string, key: string, value: unknown): {
|
|
159
|
+
set: true;
|
|
160
|
+
} | {
|
|
161
|
+
error: string;
|
|
162
|
+
detail?: string;
|
|
163
|
+
};
|
|
164
|
+
getGuidance(principal: string | null, instanceId: string): string | null;
|
|
165
|
+
getGuidanceAll(principal: string | null): Array<{
|
|
166
|
+
instanceId: string;
|
|
167
|
+
typeName: string;
|
|
168
|
+
phase: string | null;
|
|
169
|
+
guidance: string;
|
|
170
|
+
priority: number;
|
|
171
|
+
}>;
|
|
172
|
+
withPrincipalLock(principal: string | null, fn: () => Promise<unknown>): Promise<unknown>;
|
|
43
173
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* for tests. Process restart clears everything regardless.
|
|
174
|
+
* Route a tool call to the correct workflow instance(s). Returns the instance
|
|
175
|
+
* that owns this tool, or undefined if no active instance claims it. For the
|
|
176
|
+
* GM type (bespoke gating), this returns the GM instance regardless.
|
|
48
177
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
178
|
+
routeToolCall(principal: string | null, toolName: string): WorkflowInstance | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* Check if a tool is blocked by a pending approval gate. Returns an error
|
|
181
|
+
* object if blocked, or null if allowed.
|
|
182
|
+
*/
|
|
183
|
+
checkToolBlock(principal: string | null, toolName: string): ({
|
|
184
|
+
error: string;
|
|
185
|
+
phase: string;
|
|
186
|
+
blockedTool: string;
|
|
187
|
+
} & Partial<GateVerdict>) | null;
|
|
188
|
+
/**
|
|
189
|
+
* Check whether a tool is gated by any registered phased workflow type, even when
|
|
190
|
+
* the caller has no active instance (first-contact rejection).
|
|
191
|
+
*/
|
|
192
|
+
checkColdToolBlock(toolName: string): GateVerdict | null;
|
|
193
|
+
/**
|
|
194
|
+
* Record a tool call for ALL active instances that include this tool in their
|
|
195
|
+
* type definition. For legacy GM callers, the 2-arg recordCall below also works.
|
|
196
|
+
*/
|
|
197
|
+
recordCallForAll(principal: string | null, toolName: string): void;
|
|
54
198
|
recordCall(principal: string | null, toolName: string): void;
|
|
55
|
-
/** `tacit_gm_ingest` succeeded — arm the workflow, superseding any prior one. */
|
|
56
199
|
startWorkflow(principal: string | null, opts: {
|
|
57
200
|
artifactId: string;
|
|
58
201
|
catalogId: string;
|
|
59
202
|
crossReference: boolean;
|
|
60
203
|
}): void;
|
|
61
|
-
/** Guidance-attach predicate (Layer 2): true from ingest until the final placement completes. */
|
|
62
204
|
isGuidanceActive(principal: string | null): boolean;
|
|
63
|
-
/** Read-only copy of the workflow state, or null when none exists. */
|
|
64
205
|
getWorkflow(principal: string | null): WorkflowSnapshot | null;
|
|
65
|
-
/**
|
|
66
|
-
* Pyramid gate for `tacit_gm_approve`. Applied whenever an approve is attempted:
|
|
67
|
-
* the drill-down must have happened (call log since last ingest, or a validated
|
|
68
|
-
* fast-track). Re-approving after a completed placement is allowed while the log
|
|
69
|
-
* still satisfies the prerequisites (idempotent retries), but `tacit_gm_reset`
|
|
70
|
-
* or a new ingest re-arms the requirement.
|
|
71
|
-
*/
|
|
72
206
|
checkPyramidApprove(principal: string | null): GateVerdict;
|
|
73
|
-
/**
|
|
74
|
-
* KB gate for `tacit_kb_promote_from_artifact` (and the catalog variant, which
|
|
75
|
-
* resolves to the same artifact). Gated ONLY while a GM workflow is active AND
|
|
76
|
-
* artifactId matches the workflow's artifact; a different artifact or a standalone
|
|
77
|
-
* promotion (SOP-03) passes through ungated and does NOT complete the workflow.
|
|
78
|
-
*
|
|
79
|
-
* Restart asymmetry (ADR-202): a process restart mid-KB-workflow silently downgrades
|
|
80
|
-
* to this ungated path (fail-open), while checkPyramidApprove re-requires the
|
|
81
|
-
* drill-down (fail-closed). The gate is workflow hygiene, not a security boundary —
|
|
82
|
-
* backend authorization (workspace scoping, capabilities) is unaffected either way.
|
|
83
|
-
*/
|
|
84
207
|
checkKbPromote(principal: string | null, artifactId: string): GateVerdict;
|
|
85
|
-
/**
|
|
86
|
-
* Variation C fast-track: the handler validated target_path server-side against the
|
|
87
|
-
* same endpoints the list tools wrap. Satisfies the drill-down prerequisite for this
|
|
88
|
-
* cycle only; cleared by ingest supersession and by reset.
|
|
89
|
-
*/
|
|
90
208
|
markFastTrackValidated(principal: string | null): void;
|
|
91
|
-
/**
|
|
92
|
-
* A final placement succeeded — `tacit_gm_approve` (pyramid) or a promote of the
|
|
93
|
-
* workflow's own artifact (KB). With cross_reference set the workflow stays active
|
|
94
|
-
* for the second cycle; otherwise it deactivates and shared-list guidance stops.
|
|
95
|
-
*
|
|
96
|
-
* `placementKey` makes completion idempotent: the backend is idempotent, so an
|
|
97
|
-
* identical retry of an already-counted placement (same catalog+targets, or same
|
|
98
|
-
* artifact+collection) must not consume a second budget slot — in a cross_reference
|
|
99
|
-
* workflow a double-decrement would deactivate mid-flow and leave the second
|
|
100
|
-
* surface ungated (and able to land PUBLISHED). A DIFFERENT placement still counts.
|
|
101
|
-
*/
|
|
102
209
|
completePlacement(principal: string | null, placementKey: string): void;
|
|
103
|
-
/**
|
|
104
|
-
* Variation D reset: clear the call log, rearm ACTIVE whether or not a placement had
|
|
105
|
-
* completed, keep the workflow's artifact/catalog. The next surface starts its own
|
|
106
|
-
* drill-down from scratch (call log is empty; fast-track is invalidated).
|
|
107
|
-
*/
|
|
108
210
|
resetWorkflow(principal: string | null): WorkflowSnapshot;
|
|
109
|
-
/** Full teardown for the principal (tests; production teardown is process exit). */
|
|
110
211
|
clear(principal: string | null): void;
|
|
111
212
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Guidance appended to shared list-tool results while a GM workflow is active.
|
|
114
|
-
* Never attached when no workflow is active (Gap G2: COO audits and read-only
|
|
115
|
-
* browses must not see GM placement instructions).
|
|
116
|
-
*/
|
|
117
213
|
export declare const GM_LIST_TOOL_NEXT_STEP: Record<string, string>;
|
|
118
|
-
/** Appended to approve results when cross_reference is set and a second cycle remains. */
|
|
119
214
|
export declare const GM_APPROVE_NEXT_STEP: string;
|