@ai-dossier/mcp-server 1.0.2 → 1.0.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/LICENSE +661 -0
- package/README.md +110 -297
- package/dist/index.js +196 -11
- package/dist/index.js.map +1 -1
- package/dist/orchestration/outputMapper.d.ts +94 -0
- package/dist/orchestration/outputMapper.d.ts.map +1 -0
- package/dist/orchestration/outputMapper.js +129 -0
- package/dist/orchestration/outputMapper.js.map +1 -0
- package/dist/orchestration/session.d.ts +43 -0
- package/dist/orchestration/session.d.ts.map +1 -0
- package/dist/orchestration/session.js +67 -0
- package/dist/orchestration/session.js.map +1 -0
- package/dist/resources/orchestration.d.ts +7 -0
- package/dist/resources/orchestration.d.ts.map +1 -0
- package/dist/resources/orchestration.js +11 -0
- package/dist/resources/orchestration.js.map +1 -0
- package/dist/tools/cancelJourney.d.ts +20 -0
- package/dist/tools/cancelJourney.d.ts.map +1 -0
- package/dist/tools/cancelJourney.js +50 -0
- package/dist/tools/cancelJourney.js.map +1 -0
- package/dist/tools/getJourneyStatus.d.ts +29 -0
- package/dist/tools/getJourneyStatus.d.ts.map +1 -0
- package/dist/tools/getJourneyStatus.js +39 -0
- package/dist/tools/getJourneyStatus.js.map +1 -0
- package/dist/tools/readDossier.d.ts +1 -0
- package/dist/tools/readDossier.d.ts.map +1 -1
- package/dist/tools/readDossier.js +22 -1
- package/dist/tools/readDossier.js.map +1 -1
- package/dist/tools/startJourney.d.ts +26 -0
- package/dist/tools/startJourney.d.ts.map +1 -0
- package/dist/tools/startJourney.js +90 -0
- package/dist/tools/startJourney.js.map +1 -0
- package/dist/tools/stepComplete.d.ts +28 -0
- package/dist/tools/stepComplete.d.ts.map +1 -0
- package/dist/tools/stepComplete.js +101 -0
- package/dist/tools/stepComplete.js.map +1 -0
- package/package.json +7 -4
- package/dist/orchestration/__tests__/graph.test.d.ts +0 -2
- package/dist/orchestration/__tests__/graph.test.d.ts.map +0 -1
- package/dist/orchestration/__tests__/graph.test.js +0 -348
- package/dist/orchestration/__tests__/graph.test.js.map +0 -1
- package/dist/orchestration/__tests__/resolver.test.d.ts +0 -2
- package/dist/orchestration/__tests__/resolver.test.d.ts.map +0 -1
- package/dist/orchestration/__tests__/resolver.test.js +0 -181
- package/dist/orchestration/__tests__/resolver.test.js.map +0 -1
- package/dist/parsers/signatureVerifier.d.ts +0 -10
- package/dist/parsers/signatureVerifier.d.ts.map +0 -1
- package/dist/parsers/signatureVerifier.js +0 -85
- package/dist/parsers/signatureVerifier.js.map +0 -1
- package/dist/tools/__tests__/listDossiers.test.d.ts +0 -2
- package/dist/tools/__tests__/listDossiers.test.d.ts.map +0 -1
- package/dist/tools/__tests__/listDossiers.test.js +0 -67
- package/dist/tools/__tests__/listDossiers.test.js.map +0 -1
- package/dist/tools/__tests__/readDossier.test.d.ts +0 -2
- package/dist/tools/__tests__/readDossier.test.d.ts.map +0 -1
- package/dist/tools/__tests__/readDossier.test.js +0 -88
- package/dist/tools/__tests__/readDossier.test.js.map +0 -1
- package/dist/tools/__tests__/resolveGraph.test.d.ts +0 -2
- package/dist/tools/__tests__/resolveGraph.test.d.ts.map +0 -1
- package/dist/tools/__tests__/resolveGraph.test.js +0 -170
- package/dist/tools/__tests__/resolveGraph.test.js.map +0 -1
- package/dist/tools/__tests__/searchDossiers.test.d.ts +0 -2
- package/dist/tools/__tests__/searchDossiers.test.d.ts.map +0 -1
- package/dist/tools/__tests__/searchDossiers.test.js +0 -52
- package/dist/tools/__tests__/searchDossiers.test.js.map +0 -1
- package/dist/tools/__tests__/verifyDossier.test.d.ts +0 -2
- package/dist/tools/__tests__/verifyDossier.test.d.ts.map +0 -1
- package/dist/tools/__tests__/verifyDossier.test.js +0 -59
- package/dist/tools/__tests__/verifyDossier.test.js.map +0 -1
- package/dist/tools/__tests__/verifyGraph.test.d.ts +0 -2
- package/dist/tools/__tests__/verifyGraph.test.d.ts.map +0 -1
- package/dist/tools/__tests__/verifyGraph.test.js +0 -278
- package/dist/tools/__tests__/verifyGraph.test.js.map +0 -1
- package/dist/utils/__tests__/cli-wrapper.test.d.ts +0 -2
- package/dist/utils/__tests__/cli-wrapper.test.d.ts.map +0 -1
- package/dist/utils/__tests__/cli-wrapper.test.js +0 -29
- package/dist/utils/__tests__/cli-wrapper.test.js.map +0 -1
- package/dist/utils/__tests__/paths.test.d.ts +0 -2
- package/dist/utils/__tests__/paths.test.d.ts.map +0 -1
- package/dist/utils/__tests__/paths.test.js +0 -26
- package/dist/utils/__tests__/paths.test.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -35
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -68
- package/dist/utils/errors.js.map +0 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Journey session state and in-memory store.
|
|
4
|
+
* Tracks multi-dossier execution from start to finish.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.stepsFromPhases = stepsFromPhases;
|
|
8
|
+
exports.createSession = createSession;
|
|
9
|
+
exports.getSession = getSession;
|
|
10
|
+
exports.updateSession = updateSession;
|
|
11
|
+
exports.buildOutputContext = buildOutputContext;
|
|
12
|
+
exports.buildSummary = buildSummary;
|
|
13
|
+
const node_crypto_1 = require("node:crypto");
|
|
14
|
+
const sessions = new Map();
|
|
15
|
+
function stepsFromPhases(entries) {
|
|
16
|
+
return entries.map((entry) => ({
|
|
17
|
+
dossier: entry.name,
|
|
18
|
+
source: entry.source,
|
|
19
|
+
path: entry.path,
|
|
20
|
+
condition: entry.condition,
|
|
21
|
+
status: 'pending',
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
function createSession(graphId, steps) {
|
|
25
|
+
const session = {
|
|
26
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
27
|
+
graphId,
|
|
28
|
+
steps,
|
|
29
|
+
currentStepIndex: 0,
|
|
30
|
+
status: 'pending',
|
|
31
|
+
outputs: {},
|
|
32
|
+
startedAt: new Date(),
|
|
33
|
+
};
|
|
34
|
+
sessions.set(session.id, session);
|
|
35
|
+
return session;
|
|
36
|
+
}
|
|
37
|
+
function getSession(id) {
|
|
38
|
+
return sessions.get(id);
|
|
39
|
+
}
|
|
40
|
+
function updateSession(session) {
|
|
41
|
+
sessions.set(session.id, session);
|
|
42
|
+
}
|
|
43
|
+
function buildOutputContext(outputs) {
|
|
44
|
+
const parts = [];
|
|
45
|
+
for (const [dossierName, dossierOutputs] of Object.entries(outputs)) {
|
|
46
|
+
for (const [key, value] of Object.entries(dossierOutputs)) {
|
|
47
|
+
parts.push(`${key}=${String(value)} (from ${dossierName})`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return parts.length > 0 ? `Available from previous steps: ${parts.join(', ')}` : '';
|
|
51
|
+
}
|
|
52
|
+
function buildSummary(session) {
|
|
53
|
+
const completed = session.steps.filter((s) => s.status === 'completed').length;
|
|
54
|
+
const failed = session.steps.filter((s) => s.status === 'failed').length;
|
|
55
|
+
return {
|
|
56
|
+
journey_id: session.id,
|
|
57
|
+
status: session.status,
|
|
58
|
+
total_steps: session.steps.length,
|
|
59
|
+
completed_steps: completed,
|
|
60
|
+
failed_steps: failed,
|
|
61
|
+
outputs: session.outputs,
|
|
62
|
+
started_at: session.startedAt.toISOString(),
|
|
63
|
+
completed_at: session.completedAt?.toISOString(),
|
|
64
|
+
cancel_reason: session.cancelReason,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/orchestration/session.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA6BH,0CAQC;AAED,sCAYC;AAED,gCAEC;AAED,sCAEC;AAED,gDAQC;AAcD,oCAcC;AA/FD,6CAAyC;AAyBzC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA0B,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AAK,CAAC,UAAU,WAAW,GAAG,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,kCAAkC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACtF,CAAC;AAcD,SAAgB,YAAY,CAAC,OAAuB;IAClD,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,MAAM,CAAC;IAC/E,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,MAAM,CAAC;IACzE,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,EAAE;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM;QACjC,eAAe,EAAE,SAAS;QAC1B,YAAY,EAAE,MAAM;QACpB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE;QAC3C,YAAY,EAAE,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE;QAChD,aAAa,EAAE,OAAO,CAAC,YAAY;KACpC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestration.d.ts","sourceRoot":"","sources":["../../src/resources/orchestration.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,mCAAmC;AACnC,eAAO,MAAM,wBAAwB,cAA4D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* dossier://orchestration resource
|
|
4
|
+
* Provides the orchestration tool reference to LLM context
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.getOrchestrationResource = void 0;
|
|
8
|
+
const resourceLoader_1 = require("../utils/resourceLoader");
|
|
9
|
+
/** Get ORCHESTRATION.md content */
|
|
10
|
+
exports.getOrchestrationResource = (0, resourceLoader_1.createResourceLoader)('ORCHESTRATION.md', 'orchestration');
|
|
11
|
+
//# sourceMappingURL=orchestration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestration.js","sourceRoot":"","sources":["../../src/resources/orchestration.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4DAA+D;AAE/D,mCAAmC;AACtB,QAAA,wBAAwB,GAAG,IAAA,qCAAoB,EAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cancel_journey tool - Cancel an active journey session.
|
|
3
|
+
* Returns a summary of what completed before cancellation.
|
|
4
|
+
*/
|
|
5
|
+
import type { JourneySummary } from '../orchestration/session';
|
|
6
|
+
export interface CancelJourneyInput {
|
|
7
|
+
journey_id: string;
|
|
8
|
+
reason?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CancelJourneyOutput {
|
|
11
|
+
summary: JourneySummary;
|
|
12
|
+
}
|
|
13
|
+
export interface CancelJourneyError {
|
|
14
|
+
error: {
|
|
15
|
+
type: 'not_found' | 'invalid_state' | 'unknown';
|
|
16
|
+
message: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export declare function cancelJourney(input: CancelJourneyInput): CancelJourneyOutput | CancelJourneyError;
|
|
20
|
+
//# sourceMappingURL=cancelJourney.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelJourney.d.ts","sourceRoot":"","sources":["../../src/tools/cancelJourney.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/D,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE;QACL,IAAI,EAAE,WAAW,GAAG,eAAe,GAAG,SAAS,CAAC;QAChD,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,mBAAmB,GAAG,kBAAkB,CA+CjG"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* cancel_journey tool - Cancel an active journey session.
|
|
4
|
+
* Returns a summary of what completed before cancellation.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.cancelJourney = cancelJourney;
|
|
8
|
+
const session_1 = require("../orchestration/session");
|
|
9
|
+
const logger_1 = require("../utils/logger");
|
|
10
|
+
function cancelJourney(input) {
|
|
11
|
+
const { journey_id, reason } = input;
|
|
12
|
+
if (!journey_id) {
|
|
13
|
+
return { error: { type: 'unknown', message: 'journey_id is required' } };
|
|
14
|
+
}
|
|
15
|
+
const session = (0, session_1.getSession)(journey_id);
|
|
16
|
+
if (!session) {
|
|
17
|
+
return { error: { type: 'not_found', message: `No journey found with id: ${journey_id}` } };
|
|
18
|
+
}
|
|
19
|
+
if (session.status === 'completed' || session.status === 'cancelled') {
|
|
20
|
+
return {
|
|
21
|
+
error: {
|
|
22
|
+
type: 'invalid_state',
|
|
23
|
+
message: `Journey is already ${session.status}`,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
// Mark the current running step as skipped if it was in progress
|
|
28
|
+
const currentStep = session.steps[session.currentStepIndex];
|
|
29
|
+
if (currentStep?.status === 'running') {
|
|
30
|
+
currentStep.status = 'skipped';
|
|
31
|
+
}
|
|
32
|
+
// Mark all remaining pending steps as skipped
|
|
33
|
+
for (let i = session.currentStepIndex + 1; i < session.steps.length; i++) {
|
|
34
|
+
if (session.steps[i].status === 'pending') {
|
|
35
|
+
session.steps[i].status = 'skipped';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
session.status = 'cancelled';
|
|
39
|
+
session.completedAt = new Date();
|
|
40
|
+
session.cancelReason = reason;
|
|
41
|
+
(0, session_1.updateSession)(session);
|
|
42
|
+
logger_1.logger.info('Journey cancelled', {
|
|
43
|
+
journeyId: journey_id,
|
|
44
|
+
reason,
|
|
45
|
+
completedSteps: session.steps.filter((s) => s.status === 'completed').length,
|
|
46
|
+
totalSteps: session.steps.length,
|
|
47
|
+
});
|
|
48
|
+
return { summary: (0, session_1.buildSummary)(session) };
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=cancelJourney.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelJourney.js","sourceRoot":"","sources":["../../src/tools/cancelJourney.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAsBH,sCA+CC;AAlED,sDAAmF;AACnF,4CAAyC;AAkBzC,SAAgB,aAAa,CAAC,KAAyB;IACrD,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAErC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,wBAAwB,EAAE,EAAE,CAAC;IAC3E,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,UAAU,CAAC,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,6BAA6B,UAAU,EAAE,EAAE,EAAE,CAAC;IAC9F,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IAEH,OAAO,EAAE,OAAO,EAAE,IAAA,sBAAY,EAAC,OAAO,CAAC,EAAE,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* get_journey_status tool - Return current state of a journey session.
|
|
3
|
+
*/
|
|
4
|
+
import type { JourneySummary } from '../orchestration/session';
|
|
5
|
+
export interface GetJourneyStatusInput {
|
|
6
|
+
journey_id: string;
|
|
7
|
+
}
|
|
8
|
+
export interface GetJourneyStatusOutput {
|
|
9
|
+
summary: JourneySummary;
|
|
10
|
+
current_step?: {
|
|
11
|
+
index: number;
|
|
12
|
+
dossier: string;
|
|
13
|
+
status: string;
|
|
14
|
+
context?: string;
|
|
15
|
+
};
|
|
16
|
+
steps: Array<{
|
|
17
|
+
index: number;
|
|
18
|
+
dossier: string;
|
|
19
|
+
status: string;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export interface GetJourneyStatusError {
|
|
23
|
+
error: {
|
|
24
|
+
type: 'not_found' | 'unknown';
|
|
25
|
+
message: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare function getJourneyStatus(input: GetJourneyStatusInput): GetJourneyStatusOutput | GetJourneyStatusError;
|
|
29
|
+
//# sourceMappingURL=getJourneyStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getJourneyStatus.d.ts","sourceRoot":"","sources":["../../src/tools/getJourneyStatus.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/D,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,cAAc,CAAC;IACxB,YAAY,CAAC,EAAE;QACb,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,KAAK,EAAE,KAAK,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE;QACL,IAAI,EAAE,WAAW,GAAG,SAAS,CAAC;QAC9B,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,qBAAqB,GAC3B,sBAAsB,GAAG,qBAAqB,CAoChD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* get_journey_status tool - Return current state of a journey session.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getJourneyStatus = getJourneyStatus;
|
|
7
|
+
const session_1 = require("../orchestration/session");
|
|
8
|
+
const logger_1 = require("../utils/logger");
|
|
9
|
+
function getJourneyStatus(input) {
|
|
10
|
+
const { journey_id } = input;
|
|
11
|
+
if (!journey_id) {
|
|
12
|
+
return { error: { type: 'unknown', message: 'journey_id is required' } };
|
|
13
|
+
}
|
|
14
|
+
const session = (0, session_1.getSession)(journey_id);
|
|
15
|
+
if (!session) {
|
|
16
|
+
return { error: { type: 'not_found', message: `No journey found with id: ${journey_id}` } };
|
|
17
|
+
}
|
|
18
|
+
logger_1.logger.info('Journey status requested', { journeyId: journey_id, status: session.status });
|
|
19
|
+
const steps = session.steps.map((step, index) => ({
|
|
20
|
+
index,
|
|
21
|
+
dossier: step.dossier,
|
|
22
|
+
status: step.status,
|
|
23
|
+
}));
|
|
24
|
+
const currentIndex = session.currentStepIndex;
|
|
25
|
+
const currentStep = session.status === 'running' && currentIndex < session.steps.length
|
|
26
|
+
? {
|
|
27
|
+
index: currentIndex,
|
|
28
|
+
dossier: session.steps[currentIndex].dossier,
|
|
29
|
+
status: session.steps[currentIndex].status,
|
|
30
|
+
context: session.steps[currentIndex].injectedContext,
|
|
31
|
+
}
|
|
32
|
+
: undefined;
|
|
33
|
+
return {
|
|
34
|
+
summary: (0, session_1.buildSummary)(session),
|
|
35
|
+
current_step: currentStep,
|
|
36
|
+
steps,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=getJourneyStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getJourneyStatus.js","sourceRoot":"","sources":["../../src/tools/getJourneyStatus.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAgCH,4CAsCC;AAnED,sDAAoE;AACpE,4CAAyC;AA4BzC,SAAgB,gBAAgB,CAC9B,KAA4B;IAE5B,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAE7B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,wBAAwB,EAAE,EAAE,CAAC;IAC3E,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,UAAU,CAAC,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,6BAA6B,UAAU,EAAE,EAAE,EAAE,CAAC;IAC9F,CAAC;IAED,eAAM,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE3F,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAChD,KAAK;QACL,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC,CAAC,CAAC;IAEJ,MAAM,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAC9C,MAAM,WAAW,GACf,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM;QACjE,CAAC,CAAC;YACE,KAAK,EAAE,YAAY;YACnB,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,OAAO;YAC5C,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,MAAM;YAC1C,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,eAAe;SACrD;QACH,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO;QACL,OAAO,EAAE,IAAA,sBAAY,EAAC,OAAO,CAAC;QAC9B,YAAY,EAAE,WAAW;QACzB,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readDossier.d.ts","sourceRoot":"","sources":["../../src/tools/readDossier.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"readDossier.d.ts","sourceRoot":"","sources":["../../src/tools/readDossier.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAuDrF"}
|
|
@@ -33,7 +33,28 @@ async function readDossier(input) {
|
|
|
33
33
|
title: metadata.title,
|
|
34
34
|
bodyLength: body.length,
|
|
35
35
|
});
|
|
36
|
-
|
|
36
|
+
const securityNotices = [];
|
|
37
|
+
try {
|
|
38
|
+
const bodyUrls = (0, core_1.scanBodyForUrls)(body);
|
|
39
|
+
if (bodyUrls.length > 0) {
|
|
40
|
+
const declaredUrls = (0, core_1.collectDeclaredUrls)(metadata);
|
|
41
|
+
const undeclared = (0, core_1.findUndeclaredUrls)(bodyUrls, declaredUrls);
|
|
42
|
+
if (undeclared.length > 0) {
|
|
43
|
+
securityNotices.push(`WARNING: ${undeclared.length} undeclared external URL(s) found in body: ${undeclared.join(', ')}. These URLs are NOT covered by the dossier trust chain.`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (scanError) {
|
|
48
|
+
logger_1.logger.warn('Failed to scan dossier body for external URLs', {
|
|
49
|
+
dossierFile: dossierPath,
|
|
50
|
+
error: scanError instanceof Error ? scanError.message : String(scanError),
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
metadata,
|
|
55
|
+
body,
|
|
56
|
+
...(securityNotices.length > 0 ? { security_notices: securityNotices } : {}),
|
|
57
|
+
};
|
|
37
58
|
}
|
|
38
59
|
catch (error) {
|
|
39
60
|
if (error instanceof cli_wrapper_1.CliNotFoundError) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readDossier.js","sourceRoot":"","sources":["../../src/tools/readDossier.ts"],"names":[],"mappings":";AAAA;;;GAGG;;
|
|
1
|
+
{"version":3,"file":"readDossier.js","sourceRoot":"","sources":["../../src/tools/readDossier.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA2BH,kCAuDC;AAhFD,qCAAuC;AACvC,2CAM0B;AAC1B,sDAAiE;AACjE,4CAAyC;AACzC,0CAAuD;AAYvD;;GAEG;AACI,KAAK,UAAU,WAAW,CAAC,KAAuB;IACvD,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IAEpC,MAAM,YAAY,GAAG,IAAA,6BAAqB,EAAC,W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IAAI,CAAC,+CAA+C,EAAE;gBAC3D,WAAW,EAAE,WAAW;gBACxB,KAAK,EAAE,SAAS,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC;aAC1E,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,QAAQ;YACR,IAAI;YACJ,GAAG,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC7E,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,8BAAgB,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* start_journey tool - Create a journey session from a resolved graph.
|
|
3
|
+
* Returns the first step's dossier content with any injected context.
|
|
4
|
+
*/
|
|
5
|
+
export interface StartJourneyInput {
|
|
6
|
+
graph_id: string;
|
|
7
|
+
}
|
|
8
|
+
export interface StepPayload {
|
|
9
|
+
index: number;
|
|
10
|
+
dossier: string;
|
|
11
|
+
body: string;
|
|
12
|
+
context: string;
|
|
13
|
+
}
|
|
14
|
+
export interface StartJourneyOutput {
|
|
15
|
+
journey_id: string;
|
|
16
|
+
step: StepPayload;
|
|
17
|
+
total_steps: number;
|
|
18
|
+
}
|
|
19
|
+
export interface StartJourneyError {
|
|
20
|
+
error: {
|
|
21
|
+
type: 'not_found' | 'empty_graph' | 'unknown';
|
|
22
|
+
message: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare function startJourney(input: StartJourneyInput): Promise<StartJourneyOutput | StartJourneyError>;
|
|
26
|
+
//# sourceMappingURL=startJourney.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startJourney.d.ts","sourceRoot":"","sources":["../../src/tools/startJourney.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE;QACL,IAAI,EAAE,WAAW,GAAG,aAAa,GAAG,SAAS,CAAC;QAC9C,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAyCD,wBAAsB,YAAY,CAChC,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,kBAAkB,GAAG,iBAAiB,CAAC,CA6CjD"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* start_journey tool - Create a journey session from a resolved graph.
|
|
4
|
+
* Returns the first step's dossier content with any injected context.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.startJourney = startJourney;
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const core_1 = require("@ai-dossier/core");
|
|
10
|
+
const session_1 = require("../orchestration/session");
|
|
11
|
+
const graphStore_1 = require("../utils/graphStore");
|
|
12
|
+
const logger_1 = require("../utils/logger");
|
|
13
|
+
/**
|
|
14
|
+
* Fetch the markdown body of a dossier step.
|
|
15
|
+
* Local dossiers are read from disk; registry dossiers return empty string as fallback.
|
|
16
|
+
*/
|
|
17
|
+
function fetchDossierBody(entry) {
|
|
18
|
+
if (entry.source === 'local' && entry.path) {
|
|
19
|
+
try {
|
|
20
|
+
const raw = (0, node_fs_1.readFileSync)(entry.path, 'utf8');
|
|
21
|
+
try {
|
|
22
|
+
return (0, core_1.parseDossierContent)(raw).body;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return raw;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
logger_1.logger.warn('Could not read dossier file', { path: entry.path });
|
|
30
|
+
return '';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Registry dossiers: body is not available without a download step
|
|
34
|
+
return '';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Flatten execution plan phases into an ordered step list.
|
|
38
|
+
*/
|
|
39
|
+
function flattenPhases(plan) {
|
|
40
|
+
const seen = new Set();
|
|
41
|
+
const result = [];
|
|
42
|
+
for (const phase of plan.phases) {
|
|
43
|
+
for (const entry of phase.dossiers) {
|
|
44
|
+
if (!seen.has(entry.name)) {
|
|
45
|
+
seen.add(entry.name);
|
|
46
|
+
result.push(entry);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
async function startJourney(input) {
|
|
53
|
+
const { graph_id } = input;
|
|
54
|
+
if (!graph_id) {
|
|
55
|
+
return { error: { type: 'unknown', message: 'graph_id is required' } };
|
|
56
|
+
}
|
|
57
|
+
const plan = (0, graphStore_1.getGraph)(graph_id);
|
|
58
|
+
if (!plan) {
|
|
59
|
+
return { error: { type: 'not_found', message: `No graph found with id: ${graph_id}` } };
|
|
60
|
+
}
|
|
61
|
+
const entries = flattenPhases(plan);
|
|
62
|
+
if (entries.length === 0) {
|
|
63
|
+
return { error: { type: 'empty_graph', message: 'Graph has no steps to execute' } };
|
|
64
|
+
}
|
|
65
|
+
const steps = (0, session_1.stepsFromPhases)(entries);
|
|
66
|
+
const session = (0, session_1.createSession)(graph_id, steps);
|
|
67
|
+
// Start the first step
|
|
68
|
+
session.steps[0].status = 'running';
|
|
69
|
+
session.status = 'running';
|
|
70
|
+
(0, session_1.updateSession)(session);
|
|
71
|
+
const first = entries[0];
|
|
72
|
+
const body = fetchDossierBody(first);
|
|
73
|
+
logger_1.logger.info('Journey started', {
|
|
74
|
+
journeyId: session.id,
|
|
75
|
+
graphId: graph_id,
|
|
76
|
+
totalSteps: steps.length,
|
|
77
|
+
firstStep: first.name,
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
journey_id: session.id,
|
|
81
|
+
step: {
|
|
82
|
+
index: 0,
|
|
83
|
+
dossier: first.name,
|
|
84
|
+
body,
|
|
85
|
+
context: '',
|
|
86
|
+
},
|
|
87
|
+
total_steps: steps.length,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=startJourney.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startJourney.js","sourceRoot":"","sources":["../../src/tools/startJourney.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAwEH,oCA+CC;AArHD,qCAAuC;AACvC,2CAAuD;AACvD,sDAAyF;AAEzF,oDAA+C;AAC/C,4CAAyC;AA0BzC;;;GAGG;AACH,SAAS,gBAAgB,CAAC,KAAmD;IAC3E,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QAC3C,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAA,sBAAY,EAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAC7C,IAAI,CAAC;gBACH,OAAO,IAAA,0BAAmB,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACvC,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,GAAG,CAAC;YACb,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,eAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,KAAK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AAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,+BAA+B,EAAE,EAAE,CAAC;IACtF,CAAC;IAED,MAAM,KAAK,GAAG,IAAA,yBAAe,EAAC,OAAO,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,IAAA,uBAAa,EAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAE/C,uBAAuB;IACvB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC;IACpC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAA,uBAAa,EAAC,OAAO,CAAC,CAAC;IAEvB,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACzB,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAErC,eAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE;QAC7B,SAAS,EAAE,OAAO,CAAC,EAAE;QACrB,OAAO,EAAE,QAAQ;QACjB,UAAU,EAAE,KAAK,CAAC,MAAM;QACxB,SAAS,EAAE,KAAK,CAAC,IAAI;KACtB,CAAC,CAAC;IAEH,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,EAAE;QACtB,IAAI,EAAE;YACJ,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,KAAK,CAAC,IAAI;YACnB,IAAI;YACJ,OAAO,EAAE,EAAE;SACZ;QACD,WAAW,EAAE,KAAK,CAAC,MAAM;KAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* step_complete tool - Advance a journey session to the next step.
|
|
3
|
+
* Maps outputs to next step's inputs and returns the next step's dossier content.
|
|
4
|
+
*/
|
|
5
|
+
import type { JourneySummary } from '../orchestration/session';
|
|
6
|
+
import type { StepPayload } from './startJourney';
|
|
7
|
+
export interface StepCompleteInput {
|
|
8
|
+
journey_id: string;
|
|
9
|
+
outputs?: Record<string, unknown>;
|
|
10
|
+
status: 'completed' | 'failed';
|
|
11
|
+
}
|
|
12
|
+
export interface StepCompleteRunning {
|
|
13
|
+
status: 'running';
|
|
14
|
+
step: StepPayload;
|
|
15
|
+
}
|
|
16
|
+
export interface StepCompleteDone {
|
|
17
|
+
status: 'completed' | 'failed';
|
|
18
|
+
summary: JourneySummary;
|
|
19
|
+
}
|
|
20
|
+
export interface StepCompleteError {
|
|
21
|
+
error: {
|
|
22
|
+
type: 'not_found' | 'invalid_state' | 'unknown';
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export type StepCompleteOutput = StepCompleteRunning | StepCompleteDone;
|
|
27
|
+
export declare function stepComplete(input: StepCompleteInput): Promise<StepCompleteOutput | StepCompleteError>;
|
|
28
|
+
//# sourceMappingURL=stepComplete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepComplete.d.ts","sourceRoot":"","sources":["../../src/tools/stepComplete.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAe,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAQ5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC/B,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE;QACL,IAAI,EAAE,WAAW,GAAG,eAAe,GAAG,SAAS,CAAC;QAChD,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG,gBAAgB,CAAC;AAkBxE,wBAAsB,YAAY,CAChC,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,kBAAkB,GAAG,iBAAiB,CAAC,CA2FjD"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* step_complete tool - Advance a journey session to the next step.
|
|
4
|
+
* Maps outputs to next step's inputs and returns the next step's dossier content.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.stepComplete = stepComplete;
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const core_1 = require("@ai-dossier/core");
|
|
10
|
+
const session_1 = require("../orchestration/session");
|
|
11
|
+
const logger_1 = require("../utils/logger");
|
|
12
|
+
function fetchDossierBody(step) {
|
|
13
|
+
if (step.source === 'local' && step.path) {
|
|
14
|
+
try {
|
|
15
|
+
const raw = (0, node_fs_1.readFileSync)(step.path, 'utf8');
|
|
16
|
+
try {
|
|
17
|
+
return (0, core_1.parseDossierContent)(raw).body;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return raw;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return '';
|
|
28
|
+
}
|
|
29
|
+
async function stepComplete(input) {
|
|
30
|
+
const { journey_id, outputs, status } = input;
|
|
31
|
+
if (!journey_id) {
|
|
32
|
+
return { error: { type: 'unknown', message: 'journey_id is required' } };
|
|
33
|
+
}
|
|
34
|
+
const session = (0, session_1.getSession)(journey_id);
|
|
35
|
+
if (!session) {
|
|
36
|
+
return { error: { type: 'not_found', message: `No journey found with id: ${journey_id}` } };
|
|
37
|
+
}
|
|
38
|
+
if (session.status === 'completed' ||
|
|
39
|
+
session.status === 'cancelled' ||
|
|
40
|
+
session.status === 'failed') {
|
|
41
|
+
return {
|
|
42
|
+
error: {
|
|
43
|
+
type: 'invalid_state',
|
|
44
|
+
message: `Journey is already ${session.status}`,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const currentStep = session.steps[session.currentStepIndex];
|
|
49
|
+
// Record outputs and mark current step
|
|
50
|
+
if (outputs) {
|
|
51
|
+
currentStep.collectedOutputs = outputs;
|
|
52
|
+
session.outputs[currentStep.dossier] = outputs;
|
|
53
|
+
}
|
|
54
|
+
currentStep.status = status;
|
|
55
|
+
if (status === 'failed') {
|
|
56
|
+
session.status = 'failed';
|
|
57
|
+
session.completedAt = new Date();
|
|
58
|
+
(0, session_1.updateSession)(session);
|
|
59
|
+
logger_1.logger.info('Journey failed at step', {
|
|
60
|
+
journeyId: journey_id,
|
|
61
|
+
stepIndex: session.currentStepIndex,
|
|
62
|
+
dossier: currentStep.dossier,
|
|
63
|
+
});
|
|
64
|
+
return { status: 'failed', summary: (0, session_1.buildSummary)(session) };
|
|
65
|
+
}
|
|
66
|
+
// Find next step (skip optional steps that are already marked skipped)
|
|
67
|
+
const nextIndex = session.currentStepIndex + 1;
|
|
68
|
+
if (nextIndex >= session.steps.length) {
|
|
69
|
+
session.status = 'completed';
|
|
70
|
+
session.completedAt = new Date();
|
|
71
|
+
(0, session_1.updateSession)(session);
|
|
72
|
+
logger_1.logger.info('Journey completed', {
|
|
73
|
+
journeyId: journey_id,
|
|
74
|
+
totalSteps: session.steps.length,
|
|
75
|
+
});
|
|
76
|
+
return { status: 'completed', summary: (0, session_1.buildSummary)(session) };
|
|
77
|
+
}
|
|
78
|
+
// Advance to next step
|
|
79
|
+
session.currentStepIndex = nextIndex;
|
|
80
|
+
const nextStep = session.steps[nextIndex];
|
|
81
|
+
nextStep.status = 'running';
|
|
82
|
+
const context = (0, session_1.buildOutputContext)(session.outputs);
|
|
83
|
+
nextStep.injectedContext = context;
|
|
84
|
+
(0, session_1.updateSession)(session);
|
|
85
|
+
const body = fetchDossierBody(nextStep);
|
|
86
|
+
logger_1.logger.info('Journey advanced to next step', {
|
|
87
|
+
journeyId: journey_id,
|
|
88
|
+
stepIndex: nextIndex,
|
|
89
|
+
dossier: nextStep.dossier,
|
|
90
|
+
});
|
|
91
|
+
return {
|
|
92
|
+
status: 'running',
|
|
93
|
+
step: {
|
|
94
|
+
index: nextIndex,
|
|
95
|
+
dossier: nextStep.dossier,
|
|
96
|
+
body,
|
|
97
|
+
context,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=stepComplete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepComplete.js","sourceRoot":"","sources":["../../src/tools/stepComplete.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAuDH,oCA6FC;AAlJD,qCAAuC;AACvC,2CAAuD;AAEvD,sDAKkC;AAClC,4CAAyC;AA4BzC,SAAS,gBAAgB,CAAC,IAAiB;IACzC,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACzC,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAA,sBAAY,EAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAC5C,IAAI,CAAC;gBACH,OAAO,IAAA,0BAAmB,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACvC,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,GAAG,CAAC;YACb,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAEM,KAAK,UAAU,YAAY,CAChC,KAAwB;IAExB,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAE9C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,EAAE,KAAK,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AAE,SAAS;YAChB,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,IAAI;YACJ,OAAO;SACR;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-dossier/mcp-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "MCP server for dossier automation standard - enables LLMs to discover, verify, and execute dossiers",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"dossier-mcp-server": "dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"
|
|
10
|
+
"clean": "rm -rf dist",
|
|
11
|
+
"build": "npm run clean && tsc",
|
|
11
12
|
"dev": "tsx src/index.ts",
|
|
12
13
|
"start": "node dist/index.js",
|
|
13
14
|
"test": "vitest run"
|
|
@@ -32,11 +33,13 @@
|
|
|
32
33
|
"url": "https://github.com/imboard-ai/ai-dossier/issues"
|
|
33
34
|
},
|
|
34
35
|
"engines": {
|
|
35
|
-
"node": ">=
|
|
36
|
+
"node": ">=20.0.0"
|
|
36
37
|
},
|
|
37
38
|
"type": "commonjs",
|
|
39
|
+
"mcpName": "ai.imboard/dossier",
|
|
38
40
|
"files": [
|
|
39
|
-
"dist/"
|
|
41
|
+
"dist/",
|
|
42
|
+
"LICENSE"
|
|
40
43
|
],
|
|
41
44
|
"publishConfig": {
|
|
42
45
|
"access": "public",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph.test.d.ts","sourceRoot":"","sources":["../../../src/orchestration/__tests__/graph.test.ts"],"names":[],"mappings":""}
|