@llm-dev-ops/agentics-cli 1.4.4 → 1.4.7
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/adapters/base-adapter.d.ts +117 -0
- package/dist/adapters/base-adapter.d.ts.map +1 -1
- package/dist/adapters/base-adapter.js +143 -0
- package/dist/adapters/base-adapter.js.map +1 -1
- package/dist/agents/cli-ux-agent.d.ts.map +1 -1
- package/dist/agents/cli-ux-agent.js +2 -1
- package/dist/agents/cli-ux-agent.js.map +1 -1
- package/dist/auth/identity-resolver.d.ts +21 -0
- package/dist/auth/identity-resolver.d.ts.map +1 -0
- package/dist/auth/identity-resolver.js +68 -0
- package/dist/auth/identity-resolver.js.map +1 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +2 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/role-permissions.d.ts +12 -0
- package/dist/auth/role-permissions.d.ts.map +1 -0
- package/dist/auth/role-permissions.js +43 -0
- package/dist/auth/role-permissions.js.map +1 -0
- package/dist/cli/index.js +162 -157
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/deploy.d.ts +4 -4
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +83 -21
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/erp.d.ts +1 -1
- package/dist/commands/erp.d.ts.map +1 -1
- package/dist/commands/erp.js +65 -5
- package/dist/commands/erp.js.map +1 -1
- package/dist/commands/export.d.ts +5 -5
- package/dist/commands/export.js +5 -5
- package/dist/commands/inspect.d.ts +28 -0
- package/dist/commands/inspect.d.ts.map +1 -1
- package/dist/commands/inspect.js +113 -0
- package/dist/commands/inspect.js.map +1 -1
- package/dist/commands/login.d.ts +8 -6
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +171 -89
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.d.ts.map +1 -1
- package/dist/commands/logout.js +4 -1
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/plan.d.ts +8 -5
- package/dist/commands/plan.d.ts.map +1 -1
- package/dist/commands/plan.js +88 -63
- package/dist/commands/plan.js.map +1 -1
- package/dist/commands/policy.d.ts +53 -0
- package/dist/commands/policy.d.ts.map +1 -1
- package/dist/commands/policy.js +201 -5
- package/dist/commands/policy.js.map +1 -1
- package/dist/commands/quantify.d.ts +1 -1
- package/dist/commands/quantify.d.ts.map +1 -1
- package/dist/commands/quantify.js +2 -4
- package/dist/commands/quantify.js.map +1 -1
- package/dist/commands/simulate.d.ts +3 -2
- package/dist/commands/simulate.d.ts.map +1 -1
- package/dist/commands/simulate.js +154 -37
- package/dist/commands/simulate.js.map +1 -1
- package/dist/commands/usage.d.ts +3 -3
- package/dist/commands/usage.js +7 -7
- package/dist/commands/usage.js.map +1 -1
- package/dist/commands/whoami.d.ts +6 -0
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +44 -7
- package/dist/commands/whoami.js.map +1 -1
- package/dist/contracts/adr-002-operational-enforcement.d.ts +684 -0
- package/dist/contracts/adr-002-operational-enforcement.d.ts.map +1 -0
- package/dist/contracts/adr-002-operational-enforcement.js +671 -0
- package/dist/contracts/adr-002-operational-enforcement.js.map +1 -0
- package/dist/contracts/adr-003-governance-architecture.d.ts +766 -0
- package/dist/contracts/adr-003-governance-architecture.d.ts.map +1 -0
- package/dist/contracts/adr-003-governance-architecture.js +773 -0
- package/dist/contracts/adr-003-governance-architecture.js.map +1 -0
- package/dist/contracts/adr-004-enterprise-integration-memory.d.ts +1150 -0
- package/dist/contracts/adr-004-enterprise-integration-memory.d.ts.map +1 -0
- package/dist/contracts/adr-004-enterprise-integration-memory.js +1158 -0
- package/dist/contracts/adr-004-enterprise-integration-memory.js.map +1 -0
- package/dist/contracts/adr-005-system-coherence-drift-self-governance.d.ts +1393 -0
- package/dist/contracts/adr-005-system-coherence-drift-self-governance.d.ts.map +1 -0
- package/dist/contracts/adr-005-system-coherence-drift-self-governance.js +1371 -0
- package/dist/contracts/adr-005-system-coherence-drift-self-governance.js.map +1 -0
- package/dist/contracts/adr-command-semantics.d.ts +150 -0
- package/dist/contracts/adr-command-semantics.d.ts.map +1 -0
- package/dist/contracts/adr-command-semantics.js +984 -0
- package/dist/contracts/adr-command-semantics.js.map +1 -0
- package/dist/contracts/index.d.ts +5 -0
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +16 -0
- package/dist/contracts/index.js.map +1 -1
- package/dist/enterprise/index.d.ts +16 -0
- package/dist/enterprise/index.d.ts.map +1 -0
- package/dist/enterprise/index.js +17 -0
- package/dist/enterprise/index.js.map +1 -0
- package/dist/enterprise/integration-registry.d.ts +73 -0
- package/dist/enterprise/integration-registry.d.ts.map +1 -0
- package/dist/enterprise/integration-registry.js +252 -0
- package/dist/enterprise/integration-registry.js.map +1 -0
- package/dist/enterprise/lineage.d.ts +73 -0
- package/dist/enterprise/lineage.d.ts.map +1 -0
- package/dist/enterprise/lineage.js +218 -0
- package/dist/enterprise/lineage.js.map +1 -0
- package/dist/gates/argument-guard.d.ts +39 -0
- package/dist/gates/argument-guard.d.ts.map +1 -0
- package/dist/gates/argument-guard.js +180 -0
- package/dist/gates/argument-guard.js.map +1 -0
- package/dist/gates/auth-session-gate.d.ts +47 -0
- package/dist/gates/auth-session-gate.d.ts.map +1 -0
- package/dist/gates/auth-session-gate.js +151 -0
- package/dist/gates/auth-session-gate.js.map +1 -0
- package/dist/gates/execution-gate.d.ts +12 -17
- package/dist/gates/execution-gate.d.ts.map +1 -1
- package/dist/gates/execution-gate.js +74 -46
- package/dist/gates/execution-gate.js.map +1 -1
- package/dist/gates/index.d.ts +25 -2
- package/dist/gates/index.d.ts.map +1 -1
- package/dist/gates/index.js +31 -2
- package/dist/gates/index.js.map +1 -1
- package/dist/gates/lineage-gate.d.ts +55 -0
- package/dist/gates/lineage-gate.d.ts.map +1 -0
- package/dist/gates/lineage-gate.js +127 -0
- package/dist/gates/lineage-gate.js.map +1 -0
- package/dist/gates/output-format-gate.d.ts +54 -0
- package/dist/gates/output-format-gate.d.ts.map +1 -0
- package/dist/gates/output-format-gate.js +136 -0
- package/dist/gates/output-format-gate.js.map +1 -0
- package/dist/gates/service-health-gate.d.ts +56 -0
- package/dist/gates/service-health-gate.d.ts.map +1 -0
- package/dist/gates/service-health-gate.js +179 -0
- package/dist/gates/service-health-gate.js.map +1 -0
- package/dist/modules/help-renderer.d.ts +25 -0
- package/dist/modules/help-renderer.d.ts.map +1 -0
- package/dist/modules/help-renderer.js +163 -0
- package/dist/modules/help-renderer.js.map +1 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/index.js +1 -0
- package/dist/modules/index.js.map +1 -1
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +16 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/routes/auth.d.ts.map +1 -1
- package/dist/server/routes/auth.js +45 -8
- package/dist/server/routes/auth.js.map +1 -1
- package/dist/server/routes/identity.d.ts +9 -0
- package/dist/server/routes/identity.d.ts.map +1 -0
- package/dist/server/routes/identity.js +100 -0
- package/dist/server/routes/identity.js.map +1 -0
- package/dist/server/routes/index.d.ts +2 -0
- package/dist/server/routes/index.d.ts.map +1 -1
- package/dist/server/routes/index.js +2 -0
- package/dist/server/routes/index.js.map +1 -1
- package/dist/server/routes/lineage.d.ts +15 -0
- package/dist/server/routes/lineage.d.ts.map +1 -0
- package/dist/server/routes/lineage.js +128 -0
- package/dist/server/routes/lineage.js.map +1 -0
- package/dist/types/index.d.ts +134 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/identity-store.d.ts +31 -0
- package/dist/utils/identity-store.d.ts.map +1 -0
- package/dist/utils/identity-store.js +97 -0
- package/dist/utils/identity-store.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/package.json +4 -4
package/dist/server/index.js
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* - GET /ready - Readiness check
|
|
10
10
|
* - POST /v1/cli/auth/sessions - OAuth device flow session creation
|
|
11
11
|
* - GET /v1/cli/auth/sessions/:code - Poll auth status
|
|
12
|
+
* - GET /v1/identity/whoami - Identity resolution (user + org + role)
|
|
13
|
+
* - POST /v1/identity/check-permission - Server-side permission check
|
|
12
14
|
* - POST /v1/simulate - Simulation engine (inspect command)
|
|
13
15
|
* - POST /v1/manifests - Manifests service (plan command)
|
|
14
16
|
* - POST /v1/plans - Planner service (plan command)
|
|
@@ -23,7 +25,7 @@ import { serve } from '@hono/node-server';
|
|
|
23
25
|
import { Hono } from 'hono';
|
|
24
26
|
import { cors } from 'hono/cors';
|
|
25
27
|
import { logger } from 'hono/logger';
|
|
26
|
-
import { simulate, manifests, plans, runner, roi, intent, exporters, diligence, health, auth, erpsurface, } from './routes/index.js';
|
|
28
|
+
import { simulate, manifests, plans, runner, roi, intent, exporters, diligence, health, auth, erpsurface, identity, lineage, } from './routes/index.js';
|
|
27
29
|
// ============================================================================
|
|
28
30
|
// App Configuration
|
|
29
31
|
// ============================================================================
|
|
@@ -65,6 +67,8 @@ app.get('/api/v1/status', (c) => {
|
|
|
65
67
|
});
|
|
66
68
|
// Auth routes
|
|
67
69
|
app.route('/v1/cli/auth', auth);
|
|
70
|
+
// Identity routes
|
|
71
|
+
app.route('/v1/identity', identity);
|
|
68
72
|
// API v1 routes
|
|
69
73
|
app.route('/v1/simulate', simulate);
|
|
70
74
|
app.route('/v1/manifests', manifests);
|
|
@@ -75,6 +79,7 @@ app.route('/v1/intent', intent);
|
|
|
75
79
|
app.route('/v1/exporters', exporters);
|
|
76
80
|
app.route('/v1/diligence', diligence);
|
|
77
81
|
app.route('/v1/erpsurface', erpsurface);
|
|
82
|
+
app.route('/v1/lineage', lineage);
|
|
78
83
|
// ============================================================================
|
|
79
84
|
// Error Handling
|
|
80
85
|
// ============================================================================
|
|
@@ -88,6 +93,8 @@ app.notFound((c) => {
|
|
|
88
93
|
'GET /ready',
|
|
89
94
|
'POST /v1/cli/auth/sessions',
|
|
90
95
|
'GET /v1/cli/auth/sessions/:device_code',
|
|
96
|
+
'GET /v1/identity/whoami',
|
|
97
|
+
'POST /v1/identity/check-permission',
|
|
91
98
|
'POST /v1/simulate',
|
|
92
99
|
'POST /v1/manifests',
|
|
93
100
|
'POST /v1/plans',
|
|
@@ -97,6 +104,9 @@ app.notFound((c) => {
|
|
|
97
104
|
'POST /v1/exporters',
|
|
98
105
|
'POST /v1/diligence',
|
|
99
106
|
'POST /v1/erpsurface',
|
|
107
|
+
'POST /v1/lineage',
|
|
108
|
+
'GET /v1/lineage/artifact/:id',
|
|
109
|
+
'GET /v1/lineage/simulation/:id/artifacts',
|
|
100
110
|
],
|
|
101
111
|
},
|
|
102
112
|
}, 404);
|
|
@@ -128,6 +138,8 @@ serve({
|
|
|
128
138
|
console.log(` GET http://localhost:${info.port}/ready`);
|
|
129
139
|
console.log(` POST http://localhost:${info.port}/v1/cli/auth/sessions`);
|
|
130
140
|
console.log(` GET http://localhost:${info.port}/v1/cli/auth/sessions/:device_code`);
|
|
141
|
+
console.log(` GET http://localhost:${info.port}/v1/identity/whoami`);
|
|
142
|
+
console.log(` POST http://localhost:${info.port}/v1/identity/check-permission`);
|
|
131
143
|
console.log(` POST http://localhost:${info.port}/v1/simulate`);
|
|
132
144
|
console.log(` POST http://localhost:${info.port}/v1/manifests`);
|
|
133
145
|
console.log(` POST http://localhost:${info.port}/v1/plans`);
|
|
@@ -137,6 +149,9 @@ serve({
|
|
|
137
149
|
console.log(` POST http://localhost:${info.port}/v1/exporters`);
|
|
138
150
|
console.log(` POST http://localhost:${info.port}/v1/diligence`);
|
|
139
151
|
console.log(` POST http://localhost:${info.port}/v1/erpsurface`);
|
|
152
|
+
console.log(` POST http://localhost:${info.port}/v1/lineage`);
|
|
153
|
+
console.log(` GET http://localhost:${info.port}/v1/lineage/artifact/:id`);
|
|
154
|
+
console.log(` GET http://localhost:${info.port}/v1/lineage/simulation/:id/artifacts`);
|
|
140
155
|
});
|
|
141
156
|
// Export for testing and programmatic use
|
|
142
157
|
export { app };
|
package/dist/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EACL,QAAQ,EACR,SAAS,EACT,KAAK,EACL,MAAM,EACN,GAAG,EACH,MAAM,EACN,SAAS,EACT,SAAS,EACT,MAAM,EACN,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,OAAO,GACR,MAAM,mBAAmB,CAAC;AAE3B,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;AAEvB,aAAa;AACb,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC;AACvB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC;IAChB,MAAM,EAAE,GAAG;IACX,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC;IACzD,YAAY,EAAE,CAAC,cAAc,EAAE,eAAe,EAAE,kBAAkB,EAAE,YAAY,CAAC;IACjF,WAAW,EAAE,IAAI;CAClB,CAAC,CAA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AI,4EAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/server/routes/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,QAAA,MAAM,IAAI,4EAAa,CAAC;AA4KxB,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -40,14 +40,19 @@ auth.post('/sessions', async (c) => {
|
|
|
40
40
|
status: 'pending',
|
|
41
41
|
};
|
|
42
42
|
sessions.set(deviceCode, session);
|
|
43
|
-
// Auto-authorize after 3 seconds for testing
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
s.status
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
// Auto-authorize after 3 seconds for testing (only in non-production)
|
|
44
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
const s = sessions.get(deviceCode);
|
|
47
|
+
if (s && s.status === 'pending') {
|
|
48
|
+
s.status = 'authorized';
|
|
49
|
+
s.api_key = `agentics_sk_cli_${generateCode(64, 'abcdef0123456789')}`;
|
|
50
|
+
// Use test email or env var for local testing
|
|
51
|
+
s.email = process.env['AGENTICS_TEST_EMAIL'] ?? 'test@agentics.dev';
|
|
52
|
+
s.user_id = `user-${generateCode(16, 'abcdef0123456789')}`;
|
|
53
|
+
}
|
|
54
|
+
}, 3000);
|
|
55
|
+
}
|
|
51
56
|
return c.json({
|
|
52
57
|
session_id: session.session_id,
|
|
53
58
|
verification_url: session.verification_url,
|
|
@@ -66,6 +71,36 @@ auth.post('/sessions', async (c) => {
|
|
|
66
71
|
}, 500);
|
|
67
72
|
}
|
|
68
73
|
});
|
|
74
|
+
/**
|
|
75
|
+
* POST /v1/cli/auth/sessions/:device_code/authorize
|
|
76
|
+
*
|
|
77
|
+
* Authorize a session (called by web UI after OAuth completion).
|
|
78
|
+
* In production, this would be called by the platform after the user
|
|
79
|
+
* completes OAuth authentication in the browser.
|
|
80
|
+
*/
|
|
81
|
+
auth.post('/sessions/:device_code/authorize', async (c) => {
|
|
82
|
+
try {
|
|
83
|
+
const deviceCode = c.req.param('device_code');
|
|
84
|
+
const body = await c.req.json();
|
|
85
|
+
const session = sessions.get(deviceCode);
|
|
86
|
+
if (!session) {
|
|
87
|
+
return c.json({ error: { code: 'NOT_FOUND', message: 'Session not found' } }, 404);
|
|
88
|
+
}
|
|
89
|
+
if (session.status !== 'pending') {
|
|
90
|
+
return c.json({ error: { code: 'INVALID_STATE', message: 'Session already processed' } }, 400);
|
|
91
|
+
}
|
|
92
|
+
// Authorize the session with user info
|
|
93
|
+
session.status = 'authorized';
|
|
94
|
+
session.api_key = `agentics_sk_cli_${generateCode(64, 'abcdef0123456789')}`;
|
|
95
|
+
session.email = body.email;
|
|
96
|
+
session.user_id = body.user_id;
|
|
97
|
+
return c.json({ status: 'authorized', message: 'Session authorized successfully' });
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
console.error('Auth authorize error:', error);
|
|
101
|
+
return c.json({ error: { code: 'INTERNAL_ERROR', message: 'Authorization failed' } }, 500);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
69
104
|
/**
|
|
70
105
|
* GET /v1/cli/auth/sessions/:device_code
|
|
71
106
|
*
|
|
@@ -91,6 +126,8 @@ auth.get('/sessions/:device_code', async (c) => {
|
|
|
91
126
|
return c.json({
|
|
92
127
|
status: session.status,
|
|
93
128
|
api_key: session.api_key,
|
|
129
|
+
email: session.email,
|
|
130
|
+
user_id: session.user_id,
|
|
94
131
|
});
|
|
95
132
|
}
|
|
96
133
|
return c.json({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/server/routes/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,IAAI,GA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L,CAAC;QAED,OAAO,CAAC,CAAC,IAAI,CAAC;YACZ,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;QACjD,OAAO,CAAC,CAAC,IAAI,CACX;YACE,KAAK,EAAE;gBACL,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;aAClE;SACF,EACD,GAAG,CACJ,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity Route
|
|
3
|
+
*
|
|
4
|
+
* GET /v1/identity/whoami - Resolve API key into user + org + role context.
|
|
5
|
+
*/
|
|
6
|
+
import { Hono } from 'hono';
|
|
7
|
+
declare const identity: Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
8
|
+
export { identity };
|
|
9
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/server/routes/identity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAK5B,QAAA,MAAM,QAAQ,4EAAa,CAAC;AAkG5B,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity Route
|
|
3
|
+
*
|
|
4
|
+
* GET /v1/identity/whoami - Resolve API key into user + org + role context.
|
|
5
|
+
*/
|
|
6
|
+
import { Hono } from 'hono';
|
|
7
|
+
import { deriveUserId, deriveOrgId } from '../../auth/identity-resolver.js';
|
|
8
|
+
import { hasPermission } from '../../auth/role-permissions.js';
|
|
9
|
+
const identity = new Hono();
|
|
10
|
+
/**
|
|
11
|
+
* GET /whoami
|
|
12
|
+
*
|
|
13
|
+
* Resolves API key from Authorization header into full identity context.
|
|
14
|
+
* Creates user + org lazily (deterministic from key).
|
|
15
|
+
* Default role for key holder: owner.
|
|
16
|
+
*/
|
|
17
|
+
identity.get('/whoami', async (c) => {
|
|
18
|
+
try {
|
|
19
|
+
const authHeader = c.req.header('Authorization');
|
|
20
|
+
if (!authHeader || !authHeader.startsWith('Bearer ')) {
|
|
21
|
+
return c.json({
|
|
22
|
+
error: { code: 'AUTH_REQUIRED', message: 'Missing or invalid Authorization header' },
|
|
23
|
+
}, 401);
|
|
24
|
+
}
|
|
25
|
+
const apiKey = authHeader.slice('Bearer '.length);
|
|
26
|
+
if (!apiKey.startsWith('agentics_sk_')) {
|
|
27
|
+
return c.json({
|
|
28
|
+
error: { code: 'INVALID_KEY', message: 'Invalid API key format' },
|
|
29
|
+
}, 401);
|
|
30
|
+
}
|
|
31
|
+
const user_id = deriveUserId(apiKey);
|
|
32
|
+
const org_id = deriveOrgId(user_id);
|
|
33
|
+
const role = 'owner';
|
|
34
|
+
const now = new Date().toISOString();
|
|
35
|
+
return c.json({
|
|
36
|
+
authenticated: true,
|
|
37
|
+
user: {
|
|
38
|
+
user_id,
|
|
39
|
+
display_name: 'key_user',
|
|
40
|
+
created_at: now,
|
|
41
|
+
},
|
|
42
|
+
org: {
|
|
43
|
+
org_id,
|
|
44
|
+
org_name: 'default',
|
|
45
|
+
role,
|
|
46
|
+
created_at: now,
|
|
47
|
+
},
|
|
48
|
+
entitlement: 'paid',
|
|
49
|
+
execution_enabled: true,
|
|
50
|
+
resolved_at: now,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
console.error('Identity whoami error:', error);
|
|
55
|
+
return c.json({
|
|
56
|
+
error: {
|
|
57
|
+
code: 'INTERNAL_ERROR',
|
|
58
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
59
|
+
},
|
|
60
|
+
}, 500);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* POST /check-permission
|
|
65
|
+
*
|
|
66
|
+
* Server-side permission enforcement.
|
|
67
|
+
* Body: { role: OrgRole, permission: Permission }
|
|
68
|
+
*/
|
|
69
|
+
identity.post('/check-permission', async (c) => {
|
|
70
|
+
try {
|
|
71
|
+
const body = await c.req.json();
|
|
72
|
+
if (!body.role || !body.permission) {
|
|
73
|
+
return c.json({
|
|
74
|
+
error: { code: 'INVALID_REQUEST', message: 'Missing role or permission' },
|
|
75
|
+
}, 400);
|
|
76
|
+
}
|
|
77
|
+
const allowed = hasPermission(body.role, body.permission);
|
|
78
|
+
if (!allowed) {
|
|
79
|
+
return c.json({
|
|
80
|
+
error: {
|
|
81
|
+
code: 'INSUFFICIENT_PERMISSIONS',
|
|
82
|
+
message: `Role '${body.role}' lacks permission '${body.permission}'`,
|
|
83
|
+
},
|
|
84
|
+
allowed: false,
|
|
85
|
+
}, 403);
|
|
86
|
+
}
|
|
87
|
+
return c.json({ allowed: true });
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.error('Permission check error:', error);
|
|
91
|
+
return c.json({
|
|
92
|
+
error: {
|
|
93
|
+
code: 'INTERNAL_ERROR',
|
|
94
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
95
|
+
},
|
|
96
|
+
}, 500);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
export { identity };
|
|
100
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../src/server/routes/identity.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,WAAW,E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O,EAAE,KAAK;aACf,EAAE,GAAG,CAAC,CAAC;QACV,CAAC;QAED,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;QAChD,OAAO,CAAC,CAAC,IAAI,CAAC;YACZ,KAAK,EAAE;gBACL,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;aAClE;SACF,EAAE,GAAG,CAAC,CAAC;IACV,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -14,4 +14,6 @@ export { diligence } from './diligence.js';
|
|
|
14
14
|
export { health } from './health.js';
|
|
15
15
|
export { auth } from './auth.js';
|
|
16
16
|
export { erpsurface } from './erpsurface.js';
|
|
17
|
+
export { identity } from './identity.js';
|
|
18
|
+
export { lineage } from './lineage.js';
|
|
17
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/routes/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/routes/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -14,4 +14,6 @@ export { diligence } from './diligence.js';
|
|
|
14
14
|
export { health } from './health.js';
|
|
15
15
|
export { auth } from './auth.js';
|
|
16
16
|
export { erpsurface } from './erpsurface.js';
|
|
17
|
+
export { identity } from './identity.js';
|
|
18
|
+
export { lineage } from './lineage.js';
|
|
17
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/routes/index.ts"],"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QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lineage Route Handler (ADR-004)
|
|
3
|
+
*
|
|
4
|
+
* Provides lineage query endpoints for tracing artifacts to simulations
|
|
5
|
+
* and simulations to artifacts.
|
|
6
|
+
*
|
|
7
|
+
* Routes:
|
|
8
|
+
* - POST /v1/lineage - Store a lineage record
|
|
9
|
+
* - GET /v1/lineage/artifact/:id - Trace backward: artifact → simulation
|
|
10
|
+
* - GET /v1/lineage/simulation/:id/artifacts - Trace forward: simulation → artifacts
|
|
11
|
+
*/
|
|
12
|
+
import { Hono } from 'hono';
|
|
13
|
+
declare const lineage: Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
14
|
+
export { lineage };
|
|
15
|
+
//# sourceMappingURL=lineage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lineage.d.ts","sourceRoot":"","sources":["../../../src/server/routes/lineage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,QAAA,MAAM,OAAO,4EAAa,CAAC;AAkJ3B,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lineage Route Handler (ADR-004)
|
|
3
|
+
*
|
|
4
|
+
* Provides lineage query endpoints for tracing artifacts to simulations
|
|
5
|
+
* and simulations to artifacts.
|
|
6
|
+
*
|
|
7
|
+
* Routes:
|
|
8
|
+
* - POST /v1/lineage - Store a lineage record
|
|
9
|
+
* - GET /v1/lineage/artifact/:id - Trace backward: artifact → simulation
|
|
10
|
+
* - GET /v1/lineage/simulation/:id/artifacts - Trace forward: simulation → artifacts
|
|
11
|
+
*/
|
|
12
|
+
import { Hono } from 'hono';
|
|
13
|
+
import { generateId, generateChecksum } from '../utils/id-generator.js';
|
|
14
|
+
const lineage = new Hono();
|
|
15
|
+
const lineageStore = new Map();
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// POST /v1/lineage — Store a lineage record
|
|
18
|
+
// ============================================================================
|
|
19
|
+
lineage.post('/', async (c) => {
|
|
20
|
+
try {
|
|
21
|
+
const body = await c.req.json();
|
|
22
|
+
// Validate required fields (ADR-004, Invariant 3)
|
|
23
|
+
if (!body.artifact_id || !body.simulation_id) {
|
|
24
|
+
return c.json({
|
|
25
|
+
error: {
|
|
26
|
+
code: 'LINEAGE_VALIDATION_ERROR',
|
|
27
|
+
message: 'artifact_id and simulation_id are required (ADR-004, Invariant 3)',
|
|
28
|
+
},
|
|
29
|
+
}, 400);
|
|
30
|
+
}
|
|
31
|
+
const id = body.id ?? generateId('lin');
|
|
32
|
+
const entry = {
|
|
33
|
+
...body,
|
|
34
|
+
id,
|
|
35
|
+
created_at: body.created_at ?? new Date().toISOString(),
|
|
36
|
+
};
|
|
37
|
+
lineageStore.set(id, entry);
|
|
38
|
+
// Also index by artifact_id and simulation_id for queries
|
|
39
|
+
return c.json({
|
|
40
|
+
id,
|
|
41
|
+
type: 'LineageRecord',
|
|
42
|
+
artifact_id: entry.artifact_id,
|
|
43
|
+
simulation_id: entry.simulation_id,
|
|
44
|
+
created_at: entry.created_at,
|
|
45
|
+
checksum: generateChecksum(),
|
|
46
|
+
}, 201);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
console.error('Lineage store error:', error);
|
|
50
|
+
return c.json({
|
|
51
|
+
error: {
|
|
52
|
+
code: 'INTERNAL_ERROR',
|
|
53
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
54
|
+
},
|
|
55
|
+
}, 500);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
// ============================================================================
|
|
59
|
+
// GET /v1/lineage/artifact/:id — Trace backward: artifact → simulation
|
|
60
|
+
// ============================================================================
|
|
61
|
+
lineage.get('/artifact/:id', async (c) => {
|
|
62
|
+
const artifactId = c.req.param('id');
|
|
63
|
+
// Find lineage records for this artifact
|
|
64
|
+
const records = [];
|
|
65
|
+
for (const entry of lineageStore.values()) {
|
|
66
|
+
if (entry.artifact_id === artifactId) {
|
|
67
|
+
records.push(entry);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (records.length === 0) {
|
|
71
|
+
// Return stub response for demo purposes
|
|
72
|
+
return c.json({
|
|
73
|
+
artifact_id: artifactId,
|
|
74
|
+
lineage: [],
|
|
75
|
+
trace_complete: false,
|
|
76
|
+
message: 'No lineage records found for this artifact',
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return c.json({
|
|
80
|
+
artifact_id: artifactId,
|
|
81
|
+
lineage: records.map(r => ({
|
|
82
|
+
lineage_id: r.id,
|
|
83
|
+
simulation_id: r.simulation_id,
|
|
84
|
+
plan_id: r.plan_id,
|
|
85
|
+
artifact_category: r.artifact_category,
|
|
86
|
+
decision_context: r.decision_context,
|
|
87
|
+
attribution: r.attribution,
|
|
88
|
+
governance: r.governance,
|
|
89
|
+
created_at: r.created_at,
|
|
90
|
+
})),
|
|
91
|
+
trace_complete: true,
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
// ============================================================================
|
|
95
|
+
// GET /v1/lineage/simulation/:id/artifacts — Trace forward
|
|
96
|
+
// ============================================================================
|
|
97
|
+
lineage.get('/simulation/:id/artifacts', async (c) => {
|
|
98
|
+
const simulationId = c.req.param('id');
|
|
99
|
+
// Find all artifacts produced by this simulation
|
|
100
|
+
const records = [];
|
|
101
|
+
for (const entry of lineageStore.values()) {
|
|
102
|
+
if (entry.simulation_id === simulationId) {
|
|
103
|
+
records.push(entry);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (records.length === 0) {
|
|
107
|
+
// Return stub response
|
|
108
|
+
return c.json({
|
|
109
|
+
simulation_id: simulationId,
|
|
110
|
+
artifacts: [],
|
|
111
|
+
count: 0,
|
|
112
|
+
message: 'No artifacts found for this simulation',
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return c.json({
|
|
116
|
+
simulation_id: simulationId,
|
|
117
|
+
artifacts: records.map(r => ({
|
|
118
|
+
lineage_id: r.id,
|
|
119
|
+
artifact_id: r.artifact_id,
|
|
120
|
+
artifact_category: r.artifact_category,
|
|
121
|
+
plan_id: r.plan_id,
|
|
122
|
+
created_at: r.created_at,
|
|
123
|
+
})),
|
|
124
|
+
count: records.length,
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
export { lineage };
|
|
128
|
+
//# sourceMappingURL=lineage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lineage.js","sourceRoot":"","sources":["../../../src/server/routes/lineage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAExE,MAAM,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;AAkB3B,MAAM,YAAY,GAAG,IAAI,GAAG,EAAwB,CAAC;AAErD,+EAA+E;AAC/E,4CAA4C;AAC5C,+EAA+E;AAE/E,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC5B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,EAAgB,CAAC;QAE9C,kDAAkD;QAClD,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YAC7C,OAAO,CAAC,CAAC,IAAI,CAAC;gBACZ,KAAK,EAAE;oBACL,IAAI,EAAE,0BAA0B;oBAChC,OAAO,EAAE,mEAAmE;iBAC7E;aACF,EAAE,GAAG,CAAC,CAAC;QACV,CAAC;QAED,MAAM,E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,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,uBAAuB;QACvB,OAAO,CAAC,CAAC,IAAI,CAAC;YACZ,aAAa,EAAE,YAAY;YAC3B,SAAS,EAAE,EAAE;YACb,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,wCAAwC;SAClD,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,CAAC,IAAI,CAAC;QACZ,aAAa,EAAE,YAAY;QAC3B,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC3B,UAAU,EAAE,CAAC,CAAC,EAAE;YAChB,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,iBAAiB,EAAE,CAAC,CAAC,iBAAiB;YACtC,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,UAAU,EAAE,CAAC,CAAC,UAAU;SACzB,CAAC,CAAC;QACH,KAAK,EAAE,OAAO,CAAC,MAAM;KACtB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -257,6 +257,8 @@ export interface AuthCredentials {
|
|
|
257
257
|
created_at: string;
|
|
258
258
|
expires_at?: string;
|
|
259
259
|
email?: string;
|
|
260
|
+
user_id?: string;
|
|
261
|
+
payment_status?: 'paid' | 'free' | 'unknown';
|
|
260
262
|
}
|
|
261
263
|
export interface AuthTokenResponse {
|
|
262
264
|
api_key: string;
|
|
@@ -264,4 +266,136 @@ export interface AuthTokenResponse {
|
|
|
264
266
|
user_id?: string;
|
|
265
267
|
}
|
|
266
268
|
export type AuthSessionStatus = 'pending' | 'authorized' | 'expired' | 'denied';
|
|
269
|
+
export type OrgRole = 'owner' | 'admin' | 'member';
|
|
270
|
+
export interface UserIdentity {
|
|
271
|
+
user_id: string;
|
|
272
|
+
display_name: string;
|
|
273
|
+
created_at: string;
|
|
274
|
+
}
|
|
275
|
+
export interface OrgIdentity {
|
|
276
|
+
org_id: string;
|
|
277
|
+
org_name: string;
|
|
278
|
+
created_at: string;
|
|
279
|
+
}
|
|
280
|
+
export interface IdentityContext {
|
|
281
|
+
user: UserIdentity;
|
|
282
|
+
org: OrgIdentity;
|
|
283
|
+
role: OrgRole;
|
|
284
|
+
resolved_at: string;
|
|
285
|
+
}
|
|
286
|
+
export interface Attribution {
|
|
287
|
+
created_by: string;
|
|
288
|
+
org_id: string;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Artifact categories persisted into Ruvector (ADR-004, Domain 1).
|
|
292
|
+
* Every artifact is an inert proposal produced by a simulation.
|
|
293
|
+
*/
|
|
294
|
+
export type ArtifactCategory = 'simulation' | 'plan' | 'risk_assessment' | 'cost_projection' | 'integration_mapping' | 'erp_proposal' | 'decision' | 'deployment';
|
|
295
|
+
/**
|
|
296
|
+
* Lineage record linking an artifact to its parent simulation (ADR-004, Domain 2).
|
|
297
|
+
* Stored in Ruvector as first-class data, not inferred from timestamps.
|
|
298
|
+
*
|
|
299
|
+
* Invariant 3: No integration proposal exists without traceability to
|
|
300
|
+
* a simulation, a plan, and a decision context.
|
|
301
|
+
*/
|
|
302
|
+
export interface LineageRecord {
|
|
303
|
+
/** Unique lineage record ID */
|
|
304
|
+
id: string;
|
|
305
|
+
/** The artifact this lineage entry describes */
|
|
306
|
+
artifact_id: string;
|
|
307
|
+
/** The category of the artifact */
|
|
308
|
+
artifact_category: ArtifactCategory;
|
|
309
|
+
/** The simulation that produced this artifact (Invariant 2) */
|
|
310
|
+
simulation_id: string;
|
|
311
|
+
/** The plan this artifact belongs to (if applicable) */
|
|
312
|
+
plan_id?: string;
|
|
313
|
+
/** The natural language input that seeded synthesis */
|
|
314
|
+
decision_context: string;
|
|
315
|
+
/** Identity attribution (user_id, org_id) */
|
|
316
|
+
attribution: Attribution;
|
|
317
|
+
/** Governance metadata: which gate pipeline version was applied */
|
|
318
|
+
governance: {
|
|
319
|
+
gate_pipeline_version: string;
|
|
320
|
+
synthesis_classification: string;
|
|
321
|
+
};
|
|
322
|
+
/** Immutable creation timestamp */
|
|
323
|
+
created_at: string;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Simulation memory footprint persisted in Ruvector (ADR-004, Invariant 1).
|
|
327
|
+
* A simulation that exists only in memory is not a simulation —
|
|
328
|
+
* it is an untracked computation.
|
|
329
|
+
*/
|
|
330
|
+
export interface SimulationMemoryRecord {
|
|
331
|
+
/** Simulation identifier */
|
|
332
|
+
id: string;
|
|
333
|
+
type: 'simulation';
|
|
334
|
+
/** Natural language input that seeded synthesis */
|
|
335
|
+
intent: string;
|
|
336
|
+
/** Simulation status lifecycle */
|
|
337
|
+
status: 'created' | 'running' | 'completed' | 'failed';
|
|
338
|
+
/** Simulation result data (when completed) */
|
|
339
|
+
result?: unknown;
|
|
340
|
+
/** Identity attribution */
|
|
341
|
+
attribution: Attribution;
|
|
342
|
+
/** IDs of artifacts this simulation has produced */
|
|
343
|
+
artifact_ids: string[];
|
|
344
|
+
/** Immutable creation timestamp */
|
|
345
|
+
created_at: string;
|
|
346
|
+
/** Last updated timestamp */
|
|
347
|
+
updated_at: string;
|
|
348
|
+
/** Data integrity checksum */
|
|
349
|
+
checksum: string;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Integration proposal derived from a simulation (ADR-004, Domain 3).
|
|
353
|
+
* Proposals describe what would change in an enterprise system.
|
|
354
|
+
* They are never created outside of the simulation lifecycle.
|
|
355
|
+
*/
|
|
356
|
+
export interface IntegrationProposal {
|
|
357
|
+
/** Proposal identifier */
|
|
358
|
+
id: string;
|
|
359
|
+
type: 'integration_proposal';
|
|
360
|
+
/** The integration system affected (e.g. 'sap', 'salesforce') */
|
|
361
|
+
integration_name: string;
|
|
362
|
+
/** What changes would be required */
|
|
363
|
+
proposed_changes: string;
|
|
364
|
+
/** Risks introduced by this change */
|
|
365
|
+
risks: string[];
|
|
366
|
+
/** Dependencies on other proposals or artifacts */
|
|
367
|
+
dependencies: string[];
|
|
368
|
+
/** Simulation that produced this proposal (Invariant 2) */
|
|
369
|
+
simulation_id: string;
|
|
370
|
+
/** Plan this proposal belongs to */
|
|
371
|
+
plan_id?: string;
|
|
372
|
+
/** Identity attribution */
|
|
373
|
+
attribution: Attribution;
|
|
374
|
+
/** Immutable creation timestamp */
|
|
375
|
+
created_at: string;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* ERP Surface mapping derived from a simulation (ADR-004, Domain 4).
|
|
379
|
+
* Describes how enterprise-wide processes would be affected.
|
|
380
|
+
* ERP Surface never initiates simulations — it receives proposals.
|
|
381
|
+
*/
|
|
382
|
+
export interface ErpSurfaceMapping {
|
|
383
|
+
/** Mapping identifier */
|
|
384
|
+
id: string;
|
|
385
|
+
type: 'erp_mapping';
|
|
386
|
+
/** ERP system type */
|
|
387
|
+
erp_type: string;
|
|
388
|
+
/** Entity type affected */
|
|
389
|
+
entity_type: string;
|
|
390
|
+
/** Proposed changes to the enterprise model */
|
|
391
|
+
proposed_implementation: unknown;
|
|
392
|
+
/** Simulation that produced this mapping (Invariant 2) */
|
|
393
|
+
simulation_id: string;
|
|
394
|
+
/** Integration proposals this mapping depends on */
|
|
395
|
+
integration_proposal_ids: string[];
|
|
396
|
+
/** Identity attribution */
|
|
397
|
+
attribution: Attribution;
|
|
398
|
+
/** Immutable creation timestamp */
|
|
399
|
+
created_at: string;
|
|
400
|
+
}
|
|
267
401
|
//# sourceMappingURL=index.d.ts.map
|