@x12i/memorix-service 3.1.0 → 3.2.1
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/ai-services/associate-prep.d.ts +37 -0
- package/dist/ai-services/associate-prep.d.ts.map +1 -0
- package/dist/ai-services/associate-prep.js +208 -0
- package/dist/ai-services/associate-prep.js.map +1 -0
- package/dist/ai-services/chunk-markdown.d.ts +22 -0
- package/dist/ai-services/chunk-markdown.d.ts.map +1 -0
- package/dist/ai-services/chunk-markdown.js +159 -0
- package/dist/ai-services/chunk-markdown.js.map +1 -0
- package/dist/ai-services/client.d.ts +1 -1
- package/dist/ai-services/client.d.ts.map +1 -1
- package/dist/ai-services/client.js +2 -2
- package/dist/ai-services/client.js.map +1 -1
- package/dist/ai-services/normalize-output.d.ts +7 -1
- package/dist/ai-services/normalize-output.d.ts.map +1 -1
- package/dist/ai-services/normalize-output.js +340 -60
- package/dist/ai-services/normalize-output.js.map +1 -1
- package/dist/ai-services/skill-execution.d.ts +3 -2
- package/dist/ai-services/skill-execution.d.ts.map +1 -1
- package/dist/ai-services/skill-execution.js +24 -4
- package/dist/ai-services/skill-execution.js.map +1 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +4 -0
- package/dist/app.js.map +1 -1
- package/dist/connector-catalog.d.ts +79 -0
- package/dist/connector-catalog.d.ts.map +1 -0
- package/dist/connector-catalog.js +286 -0
- package/dist/connector-catalog.js.map +1 -0
- package/dist/connector-role.d.ts +22 -0
- package/dist/connector-role.d.ts.map +1 -0
- package/dist/connector-role.js +71 -0
- package/dist/connector-role.js.map +1 -0
- package/dist/destination-runtime.d.ts +8 -0
- package/dist/destination-runtime.d.ts.map +1 -0
- package/dist/destination-runtime.js +11 -0
- package/dist/destination-runtime.js.map +1 -0
- package/dist/execution-target.d.ts +141 -0
- package/dist/execution-target.d.ts.map +1 -0
- package/dist/execution-target.js +853 -0
- package/dist/execution-target.js.map +1 -0
- package/dist/generic-connectors.d.ts +43 -0
- package/dist/generic-connectors.d.ts.map +1 -0
- package/dist/generic-connectors.js +198 -0
- package/dist/generic-connectors.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jobs-scope.d.ts +21 -0
- package/dist/jobs-scope.d.ts.map +1 -0
- package/dist/jobs-scope.js +83 -0
- package/dist/jobs-scope.js.map +1 -0
- package/dist/live.d.ts +11 -0
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +700 -73
- package/dist/live.js.map +1 -1
- package/dist/magit/magit-pack-service.d.ts +80 -0
- package/dist/magit/magit-pack-service.d.ts.map +1 -1
- package/dist/magit/magit-pack-service.js +233 -11
- package/dist/magit/magit-pack-service.js.map +1 -1
- package/dist/magit/pack-to-patchset.d.ts +16 -0
- package/dist/magit/pack-to-patchset.d.ts.map +1 -1
- package/dist/magit/pack-to-patchset.js +46 -0
- package/dist/magit/pack-to-patchset.js.map +1 -1
- package/dist/magit/package-catalog-bridge.d.ts +5 -5
- package/dist/magit/package-catalog-bridge.d.ts.map +1 -1
- package/dist/magit/package-catalog-bridge.js +3 -3
- package/dist/magit/package-catalog-bridge.js.map +1 -1
- package/dist/mgc-packages.d.ts +11 -0
- package/dist/mgc-packages.d.ts.map +1 -0
- package/dist/mgc-packages.js +11 -0
- package/dist/mgc-packages.js.map +1 -0
- package/dist/openapi/openapi.json +3445 -791
- package/dist/pipeline-compile.d.ts +46 -3
- package/dist/pipeline-compile.d.ts.map +1 -1
- package/dist/pipeline-compile.js +455 -89
- package/dist/pipeline-compile.js.map +1 -1
- package/dist/pipeline-invoke.d.ts +63 -0
- package/dist/pipeline-invoke.d.ts.map +1 -0
- package/dist/pipeline-invoke.js +114 -0
- package/dist/pipeline-invoke.js.map +1 -0
- package/dist/pipeline-ports.d.ts +13 -0
- package/dist/pipeline-ports.d.ts.map +1 -0
- package/dist/pipeline-ports.js +104 -0
- package/dist/pipeline-ports.js.map +1 -0
- package/dist/platform.d.ts +30 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +239 -8
- package/dist/platform.js.map +1 -1
- package/dist/routes/connector-invocations.d.ts.map +1 -1
- package/dist/routes/connector-invocations.js +18 -21
- package/dist/routes/connector-invocations.js.map +1 -1
- package/dist/routes/jobs.d.ts +4 -0
- package/dist/routes/jobs.d.ts.map +1 -0
- package/dist/routes/jobs.js +888 -0
- package/dist/routes/jobs.js.map +1 -0
- package/dist/routes/memory.d.ts.map +1 -1
- package/dist/routes/memory.js +148 -79
- package/dist/routes/memory.js.map +1 -1
- package/dist/routes/metadata.d.ts.map +1 -1
- package/dist/routes/metadata.js +171 -40
- package/dist/routes/metadata.js.map +1 -1
- package/dist/routes/pipelines.d.ts.map +1 -1
- package/dist/routes/pipelines.js +98 -22
- package/dist/routes/pipelines.js.map +1 -1
- package/dist/routes/relationships.d.ts.map +1 -1
- package/dist/routes/relationships.js +80 -2
- package/dist/routes/relationships.js.map +1 -1
- package/dist/runx/client.d.ts +18 -0
- package/dist/runx/client.d.ts.map +1 -0
- package/dist/runx/client.js +59 -0
- package/dist/runx/client.js.map +1 -0
- package/openapi/openapi.json +3445 -791
- package/package.json +16 -9
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared pipeline invoke path used by:
|
|
3
|
+
* - POST /api/pipelines/:pipelineId/invoke
|
|
4
|
+
* - POST /api/capability/invoke (pipeline:* services)
|
|
5
|
+
* - run-pipeline step port
|
|
6
|
+
*/
|
|
7
|
+
import type { PipelineDefinition, PipelineRun, PipelineRuntime } from "@x12i/memorix-pipeline/v2";
|
|
8
|
+
/** Minimal platform surface for pipeline invoke (avoids circular imports). */
|
|
9
|
+
export type PipelineInvokePlatform = {
|
|
10
|
+
metadata: {
|
|
11
|
+
resolveEffective: (agentIds: string[]) => {
|
|
12
|
+
effective?: Array<{
|
|
13
|
+
kind: string;
|
|
14
|
+
id: string;
|
|
15
|
+
definition: Record<string, unknown>;
|
|
16
|
+
}>;
|
|
17
|
+
};
|
|
18
|
+
getDefinition: (agentIds: string[], kind: string, id: string) => {
|
|
19
|
+
definition: unknown;
|
|
20
|
+
} | null | undefined;
|
|
21
|
+
};
|
|
22
|
+
portsFor: (scope: {
|
|
23
|
+
orgId: string;
|
|
24
|
+
agentIds: string[];
|
|
25
|
+
}) => {
|
|
26
|
+
pipeline: PipelineRuntime;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type PipelineInvokeLineage = {
|
|
30
|
+
parentRunId?: string;
|
|
31
|
+
parentStepId?: string;
|
|
32
|
+
parentAttempt?: number;
|
|
33
|
+
parentCallStack?: string[];
|
|
34
|
+
maxDepth?: number;
|
|
35
|
+
};
|
|
36
|
+
export type InvokePipelineOptions = {
|
|
37
|
+
platform: PipelineInvokePlatform;
|
|
38
|
+
orgId: string;
|
|
39
|
+
agentIds: string[];
|
|
40
|
+
pipelineId: string;
|
|
41
|
+
input?: unknown;
|
|
42
|
+
/** When false, return without depending on full completion (start still runs DAG). */
|
|
43
|
+
wait?: boolean;
|
|
44
|
+
lineage?: PipelineInvokeLineage;
|
|
45
|
+
/** Optional inline definition (tests). */
|
|
46
|
+
definition?: unknown;
|
|
47
|
+
};
|
|
48
|
+
export type InvokePipelineResult = {
|
|
49
|
+
run: PipelineRun;
|
|
50
|
+
pipelineId: string;
|
|
51
|
+
outputs: Record<string, unknown>;
|
|
52
|
+
status: PipelineRun["status"];
|
|
53
|
+
};
|
|
54
|
+
export declare function compileInstalledPipelineDefinition(platform: PipelineInvokePlatform, agentIds: string[], definition: unknown): PipelineDefinition;
|
|
55
|
+
export declare function loadAndCompilePipeline(platform: PipelineInvokePlatform, agentIds: string[], pipelineId: string, inlineDefinition?: unknown): PipelineDefinition;
|
|
56
|
+
/**
|
|
57
|
+
* Start (and by default wait for) a pipeline run. Nested calls use startChild.
|
|
58
|
+
*/
|
|
59
|
+
export declare function invokePipeline(opts: InvokePipelineOptions): Promise<InvokePipelineResult>;
|
|
60
|
+
/** Parse capability serviceId for pipeline invoke (`pipeline:{id}` or bare pipeline id). */
|
|
61
|
+
export declare function parsePipelineServiceId(serviceId: string, knownIds: Set<string>): string | null;
|
|
62
|
+
export declare function virtualPipelineServiceId(pipelineId: string): string;
|
|
63
|
+
//# sourceMappingURL=pipeline-invoke.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-invoke.d.ts","sourceRoot":"","sources":["../src/pipeline-invoke.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAQnC,8EAA8E;AAC9E,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE;QACR,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK;YACxC,SAAS,CAAC,EAAE,KAAK,CAAC;gBAChB,IAAI,EAAE,MAAM,CAAC;gBACb,EAAE,EAAE,MAAM,CAAC;gBACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;aACrC,CAAC,CAAC;SACJ,CAAC;QACF,aAAa,EAAE,CACb,QAAQ,EAAE,MAAM,EAAE,EAClB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,KACP;YAAE,UAAU,EAAE,OAAO,CAAA;SAAE,GAAG,IAAI,GAAG,SAAS,CAAC;KACjD,CAAC;IACF,QAAQ,EAAE,CAAC,KAAK,EAAE;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,KAAK;QAAE,QAAQ,EAAE,eAAe,CAAA;KAAE,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;I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MAAM,CAEnE"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { compileAuthoringPipeline, resolveKnowxWorkerBaseUrl, } from "./pipeline-compile.js";
|
|
2
|
+
import { ServiceError } from "./errors.js";
|
|
3
|
+
function serviceDefsFor(platform, agentIds) {
|
|
4
|
+
const effective = platform.metadata.resolveEffective(agentIds);
|
|
5
|
+
return (effective.effective ?? [])
|
|
6
|
+
.filter((e) => e.kind === "services")
|
|
7
|
+
.map((e) => e.definition);
|
|
8
|
+
}
|
|
9
|
+
function knownPipelineIds(platform, agentIds) {
|
|
10
|
+
const effective = platform.metadata.resolveEffective(agentIds);
|
|
11
|
+
const ids = new Set();
|
|
12
|
+
for (const e of effective.effective ?? []) {
|
|
13
|
+
if (e.kind !== "pipelines")
|
|
14
|
+
continue;
|
|
15
|
+
const d = e.definition;
|
|
16
|
+
const id = String(d.pipelineId ?? d.id ?? e.id ?? "").trim();
|
|
17
|
+
if (id)
|
|
18
|
+
ids.add(id);
|
|
19
|
+
}
|
|
20
|
+
return ids;
|
|
21
|
+
}
|
|
22
|
+
export function compileInstalledPipelineDefinition(platform, agentIds, definition) {
|
|
23
|
+
const serviceDefs = serviceDefsFor(platform, agentIds);
|
|
24
|
+
const knownServiceIds = new Set(serviceDefs
|
|
25
|
+
.map((s) => String(s.serviceId ?? s.id ?? "").trim())
|
|
26
|
+
.filter(Boolean));
|
|
27
|
+
try {
|
|
28
|
+
return compileAuthoringPipeline(definition, {
|
|
29
|
+
knownServiceIds,
|
|
30
|
+
workerBaseUrl: resolveKnowxWorkerBaseUrl(),
|
|
31
|
+
serviceDefs,
|
|
32
|
+
knownPipelineIds: knownPipelineIds(platform, agentIds),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
throw new ServiceError("VALIDATION", err instanceof Error ? err.message : String(err), 400);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export function loadAndCompilePipeline(platform, agentIds, pipelineId, inlineDefinition) {
|
|
40
|
+
let definition = inlineDefinition;
|
|
41
|
+
if (!definition) {
|
|
42
|
+
const def = platform.metadata.getDefinition(agentIds, "pipelines", pipelineId);
|
|
43
|
+
if (!def?.definition) {
|
|
44
|
+
throw new ServiceError("NOT_FOUND", `pipeline ${pipelineId} not found`, 404);
|
|
45
|
+
}
|
|
46
|
+
definition = def.definition;
|
|
47
|
+
}
|
|
48
|
+
return compileInstalledPipelineDefinition(platform, agentIds, definition);
|
|
49
|
+
}
|
|
50
|
+
function collectOutputs(run) {
|
|
51
|
+
const out = {};
|
|
52
|
+
for (const [k, v] of Object.entries(run.context ?? {})) {
|
|
53
|
+
out[k] = v;
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Start (and by default wait for) a pipeline run. Nested calls use startChild.
|
|
59
|
+
*/
|
|
60
|
+
export async function invokePipeline(opts) {
|
|
61
|
+
const { platform, orgId, agentIds, pipelineId, input, wait = true, lineage, definition: inline, } = opts;
|
|
62
|
+
if (!orgId?.trim()) {
|
|
63
|
+
throw new ServiceError("VALIDATION", "orgId required", 400);
|
|
64
|
+
}
|
|
65
|
+
if (!agentIds?.length) {
|
|
66
|
+
throw new ServiceError("VALIDATION", "agentIds required", 400);
|
|
67
|
+
}
|
|
68
|
+
const compiled = loadAndCompilePipeline(platform, agentIds, pipelineId, inline);
|
|
69
|
+
if (!compiled.pipelineId) {
|
|
70
|
+
compiled.pipelineId = pipelineId;
|
|
71
|
+
}
|
|
72
|
+
const ports = platform.portsFor({ orgId, agentIds });
|
|
73
|
+
let run;
|
|
74
|
+
if (lineage?.parentRunId && lineage.parentStepId) {
|
|
75
|
+
run = await ports.pipeline.startChild(compiled, input, {
|
|
76
|
+
parentRunId: lineage.parentRunId,
|
|
77
|
+
parentStepId: lineage.parentStepId,
|
|
78
|
+
parentAttempt: lineage.parentAttempt,
|
|
79
|
+
parentCallStack: lineage.parentCallStack,
|
|
80
|
+
maxDepth: lineage.maxDepth,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
run = await ports.pipeline.start(compiled, input, {
|
|
85
|
+
trigger: "on-demand",
|
|
86
|
+
callDepth: 0,
|
|
87
|
+
pipelineCallStack: [compiled.pipelineId],
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
void wait;
|
|
91
|
+
return {
|
|
92
|
+
run,
|
|
93
|
+
pipelineId: compiled.pipelineId,
|
|
94
|
+
outputs: collectOutputs(run),
|
|
95
|
+
status: run.status,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/** Parse capability serviceId for pipeline invoke (`pipeline:{id}` or bare pipeline id). */
|
|
99
|
+
export function parsePipelineServiceId(serviceId, knownIds) {
|
|
100
|
+
const raw = serviceId.trim();
|
|
101
|
+
if (!raw)
|
|
102
|
+
return null;
|
|
103
|
+
if (raw.startsWith("pipeline:")) {
|
|
104
|
+
const id = raw.slice("pipeline:".length).trim();
|
|
105
|
+
return id || null;
|
|
106
|
+
}
|
|
107
|
+
if (knownIds.has(raw))
|
|
108
|
+
return raw;
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
export function virtualPipelineServiceId(pipelineId) {
|
|
112
|
+
return `pipeline:${pipelineId}`;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=pipeline-invoke.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-invoke.js","sourceRoot":"","sources":["../src/pipeline-invoke.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAE1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAoD3C,SAAS,cAAc,CACrB,QAAgC,EAChC,QAAkB;IAElB,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC/D,OAAO,CAAC,SAAS,CAAC,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OAAO,EAAE,WAAW;YACpB,SAAS,EAAE,CAAC;YACZ,iBAAiB,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;SACzC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,IAAI,CAAC;IAEV,OAAO;QACL,GAAG;QACH,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC;QAC5B,MAAM,EAAE,GAAG,CAAC,MAAM;KACnB,CAAC;AACJ,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,sBAAsB,CACpC,SAAiB,EACjB,QAAqB;IAErB,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,IAAI,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAChC,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAChD,OAAO,EAAE,IAAI,IAAI,CAAC;IACpB,CAAC;IACD,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IAClC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,UAAkB;IACzD,OAAO,YAAY,UAAU,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Port handlers for run-pipeline and runx steps (host-side).
|
|
3
|
+
*/
|
|
4
|
+
import type { PortHandler, PipelineRuntime } from "@x12i/memorix-pipeline/v2";
|
|
5
|
+
import { type PipelineInvokePlatform } from "./pipeline-invoke.js";
|
|
6
|
+
export declare function createRunPipelinePort(opts: {
|
|
7
|
+
platform: PipelineInvokePlatform;
|
|
8
|
+
getRuntime: () => PipelineRuntime;
|
|
9
|
+
}): PortHandler;
|
|
10
|
+
export declare function createRunxPort(): PortHandler;
|
|
11
|
+
/** Prefer remote whenever `portConfig.endpoint` or AI protocol is present. */
|
|
12
|
+
export declare function createRemoteOrLocalPort(local: PortHandler, remote: PortHandler): PortHandler;
|
|
13
|
+
//# sourceMappingURL=pipeline-ports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-ports.d.ts","sourceRoot":"","sources":["../src/pipeline-ports.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EAEhB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,sBAAsB,CAAC;AAe9B,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,QAAQ,EAAE,sBAAsB,CAAC;IACjC,UAAU,EAAE,MAAM,eAAe,CAAC;CACnC,GAAG,WAAW,CAiEd;AAED,wBAAgB,cAAc,IAAI,WAAW,CAuB5C;AAED,8EAA8E;AAC9E,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,WAAW,GAClB,WAAW,CAWb"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { invokePipeline, } from "./pipeline-invoke.js";
|
|
2
|
+
import { runRunxCapability } from "./runx/client.js";
|
|
3
|
+
function fail(code, message, retryable = false) {
|
|
4
|
+
return { status: "failed", retryable, error: { code, message } };
|
|
5
|
+
}
|
|
6
|
+
function ok(output) {
|
|
7
|
+
return { status: "succeeded", output };
|
|
8
|
+
}
|
|
9
|
+
export function createRunPipelinePort(opts) {
|
|
10
|
+
return async (req) => {
|
|
11
|
+
const c = (req.config ?? {});
|
|
12
|
+
const pipelineId = String(c.pipelineId ?? "").trim();
|
|
13
|
+
if (!pipelineId) {
|
|
14
|
+
return fail("PIPELINE_ID_REQUIRED", "portConfig.pipelineId required", false);
|
|
15
|
+
}
|
|
16
|
+
const runtime = opts.getRuntime();
|
|
17
|
+
let parentCallStack;
|
|
18
|
+
try {
|
|
19
|
+
const parent = await runtime.getRun(req.runId);
|
|
20
|
+
parentCallStack =
|
|
21
|
+
parent?.pipelineCallStack ??
|
|
22
|
+
(parent?.pipelineId ? [parent.pipelineId] : undefined);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
parentCallStack = undefined;
|
|
26
|
+
}
|
|
27
|
+
const lineage = {
|
|
28
|
+
parentRunId: req.runId,
|
|
29
|
+
parentStepId: req.stepId,
|
|
30
|
+
parentAttempt: req.attempt,
|
|
31
|
+
parentCallStack,
|
|
32
|
+
};
|
|
33
|
+
try {
|
|
34
|
+
const result = await invokePipeline({
|
|
35
|
+
platform: opts.platform,
|
|
36
|
+
orgId: req.scope.orgId,
|
|
37
|
+
agentIds: [...req.scope.agentIds],
|
|
38
|
+
pipelineId,
|
|
39
|
+
input: req.inputs,
|
|
40
|
+
wait: true,
|
|
41
|
+
lineage,
|
|
42
|
+
});
|
|
43
|
+
if (result.status === "failed" || result.status === "cancelled") {
|
|
44
|
+
return fail(result.run.error?.code ?? "CHILD_PIPELINE_FAILED", result.run.error?.message ??
|
|
45
|
+
`child pipeline ${pipelineId} ended with status ${result.status}`, false);
|
|
46
|
+
}
|
|
47
|
+
return ok({
|
|
48
|
+
port: "run-pipeline",
|
|
49
|
+
childPipelineId: pipelineId,
|
|
50
|
+
childRunId: result.run.runId,
|
|
51
|
+
childStatus: result.status,
|
|
52
|
+
outputs: result.outputs,
|
|
53
|
+
parentRunId: req.runId,
|
|
54
|
+
parentStepId: req.stepId,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
59
|
+
const code = message.includes("PIPELINE_CALL_CYCLE")
|
|
60
|
+
? "PIPELINE_CALL_CYCLE"
|
|
61
|
+
: message.includes("PIPELINE_CALL_DEPTH")
|
|
62
|
+
? "PIPELINE_CALL_DEPTH"
|
|
63
|
+
: "CHILD_PIPELINE_ERROR";
|
|
64
|
+
return fail(code, message, false);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export function createRunxPort() {
|
|
69
|
+
return async (req) => {
|
|
70
|
+
const c = (req.config ?? {});
|
|
71
|
+
const capabilityId = String(c.capabilityId ?? "").trim();
|
|
72
|
+
if (!capabilityId) {
|
|
73
|
+
return fail("RUNX_CAPABILITY_REQUIRED", "portConfig.capabilityId required", false);
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const out = await runRunxCapability(capabilityId, req.inputs);
|
|
77
|
+
return ok({
|
|
78
|
+
port: "runx",
|
|
79
|
+
capabilityId: out.capabilityId,
|
|
80
|
+
result: out.result,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
85
|
+
const code = err && typeof err === "object" && "code" in err
|
|
86
|
+
? String(err.code ?? "RUNX_FAILED")
|
|
87
|
+
: "RUNX_FAILED";
|
|
88
|
+
return fail(code, message, code === "RUNX_NOT_CONFIGURED" ? false : true);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/** Prefer remote whenever `portConfig.endpoint` or AI protocol is present. */
|
|
93
|
+
export function createRemoteOrLocalPort(local, remote) {
|
|
94
|
+
return async (req) => {
|
|
95
|
+
const c = (req.config ?? {});
|
|
96
|
+
const hasRemote = Boolean(String(c.endpoint ?? "").trim()) ||
|
|
97
|
+
String(c.invokeProtocol ?? "").trim() === "ai-services/1";
|
|
98
|
+
if (hasRemote) {
|
|
99
|
+
return remote(req);
|
|
100
|
+
}
|
|
101
|
+
return local(req);
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=pipeline-ports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-ports.js","sourceRoot":"","sources":["../src/pipeline-ports.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,cAAc,GAGf,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OAAO,EAAE,IAAI,KAAK,qBAAqB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,uBAAuB,CACrC,KAAkB,EAClB,MAAmB;IAEnB,OAAO,KAAK,EAAE,GAAG,EAAE,EAAE;QACnB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAA4B,CAAC;QACxD,MAAM,SAAS,GACb,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;YACxC,MAAM,CAAC,CAAC,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,eAAe,CAAC;QAC5D,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;QACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/platform.d.ts
CHANGED
|
@@ -6,15 +6,17 @@ import { MongoClient, type Db } from "mongodb";
|
|
|
6
6
|
import { type UnifiedMetadataClient } from "@x12i/memorix-metadata-runtime";
|
|
7
7
|
import { type MemorixContentReader, type MemorixContentWriter, type MemorixAbstractWriter } from "@x12i/memorix-data";
|
|
8
8
|
import { type RelationshipEngine } from "@x12i/memorix-relationships";
|
|
9
|
-
import { type MemoryCollector, type MemoryRunStore, type MemoryScheduleStore, type OrgRuntimeSourceStore, type ConnectorRegistry } from "@x12i/memorix-memory";
|
|
9
|
+
import { type MemoryCollector, type MemoryRunStore, type MemoryScheduleStore, type OrgRuntimeSourceStore, type ConnectorRegistry, type InvocationLedger, type DestinationStore, type MemoryDeliverer } from "@x12i/memorix-memory";
|
|
10
10
|
import { type GovernedCredentialProvider } from "@x12i/credorix-client";
|
|
11
11
|
import { type IntelligenceArtifactPersistence } from "@x12i/memorix-intelligence";
|
|
12
12
|
import { type RunLedger, type PipelineRuntime } from "@x12i/memorix-pipeline/v2";
|
|
13
|
+
import { type OperationalStores } from "@x12i/memorix-pipeline-runtime";
|
|
13
14
|
import { ServiceError } from "./errors.js";
|
|
14
15
|
import { type ServiceCatalog } from "./catalog-bridge.js";
|
|
15
16
|
import type { MemorixScope } from "./scope.js";
|
|
16
17
|
import { type IsolationSession } from "./isolation.js";
|
|
17
18
|
import { type MagitPackService } from "./magit/magit-pack-service.js";
|
|
19
|
+
import { type GenericConnectorsConfig } from "./generic-connectors.js";
|
|
18
20
|
export type RuntimeMode = "dev" | "prod";
|
|
19
21
|
export type PlatformDeps = {
|
|
20
22
|
mode: RuntimeMode;
|
|
@@ -35,6 +37,8 @@ export type OrgPorts = {
|
|
|
35
37
|
memoryScheduleStore: MemoryScheduleStore;
|
|
36
38
|
orgRuntimeSources: OrgRuntimeSourceStore;
|
|
37
39
|
pipeline: PipelineRuntime;
|
|
40
|
+
destinations: DestinationStore;
|
|
41
|
+
deliverer: MemoryDeliverer;
|
|
38
42
|
};
|
|
39
43
|
export type MemorixPlatform = {
|
|
40
44
|
mode: RuntimeMode;
|
|
@@ -57,6 +61,14 @@ export type MemorixPlatform = {
|
|
|
57
61
|
appendInstallLedger(entry: import("@x12i/memorix-metadata-runtime").InstallLedgerEntry): void;
|
|
58
62
|
/** In-process connector registry for framework connectors. */
|
|
59
63
|
connectorRegistry: ConnectorRegistry;
|
|
64
|
+
/** Phase 4 shared invocation ledger (remote FR-040 grants). */
|
|
65
|
+
invocationLedger: InvocationLedger;
|
|
66
|
+
/** Org destination definitions + deliver receipts. */
|
|
67
|
+
destinationStore: DestinationStore;
|
|
68
|
+
/** Target deliverer (remote MGC target host). */
|
|
69
|
+
deliverer: MemoryDeliverer;
|
|
70
|
+
/** Generic connectors platform env (MGC zone). */
|
|
71
|
+
genericConnectors: GenericConnectorsConfig;
|
|
60
72
|
/** Credorix governed credentials — required in prod when CREDORIX_SERVICE_URL is set. */
|
|
61
73
|
credorix: {
|
|
62
74
|
provider: GovernedCredentialProvider;
|
|
@@ -69,6 +81,16 @@ export type MemorixPlatform = {
|
|
|
69
81
|
operationalDbFor(orgId: string): Db;
|
|
70
82
|
metadataDbFor(orgId: string): Db;
|
|
71
83
|
pipelineLedgerFor(orgId: string): RunLedger;
|
|
84
|
+
/**
|
|
85
|
+
* Org-scoped operational stores (Work, batches, evaluations, queue settings).
|
|
86
|
+
* Mongo when available; in-memory fallback in no-mongo dev.
|
|
87
|
+
*/
|
|
88
|
+
operationalStoresFor(orgId: string): OperationalStores;
|
|
89
|
+
/**
|
|
90
|
+
* Known operational org ids: in-memory caches union Mongo `*_operational` DBs when available.
|
|
91
|
+
* Used by Jobs Manager unscoped (All orgs) list/overview fan-out.
|
|
92
|
+
*/
|
|
93
|
+
listKnownOperationalOrgIds(): Promise<string[]>;
|
|
72
94
|
intelligenceArtifactsFor(orgId: string): IntelligenceArtifactPersistence;
|
|
73
95
|
/** Fail-closed: throws if ports cannot be constructed. */
|
|
74
96
|
portsFor(scope: MemorixScope): OrgPorts;
|
|
@@ -82,6 +104,13 @@ export type MemorixPlatform = {
|
|
|
82
104
|
intervalMs?: number;
|
|
83
105
|
ownerId?: string;
|
|
84
106
|
}): () => void;
|
|
107
|
+
/**
|
|
108
|
+
* Start Jobs Work evaluation + promoteHeld ticker.
|
|
109
|
+
* Works with memory stores in no-mongo dev (ticks cached orgs).
|
|
110
|
+
*/
|
|
111
|
+
startJobsWorkTicker(opts?: {
|
|
112
|
+
intervalMs?: number;
|
|
113
|
+
}): () => void;
|
|
85
114
|
close(): Promise<void>;
|
|
86
115
|
diagnostics(scope: MemorixScope): Record<string, unknown>;
|
|
87
116
|
};
|
package/dist/platform.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,WA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