@feltdb/core 0.6.11 → 0.6.12
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/cli/index.js +1 -1
- package/dist/cli/workspace-integration.js +5 -0
- package/dist/create/package-versions.js +1 -1
- package/dist/workspace/browser.d.ts +1 -1
- package/dist/workspace/browser.d.ts.map +1 -1
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/runtime-observer.js +4 -4
- package/dist/workspace/workspace-connection.d.ts +33 -1
- package/dist/workspace/workspace-connection.d.ts.map +1 -1
- package/dist/workspace/workspace-connection.js +117 -2
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import * as path from 'path';
|
|
|
23
23
|
import * as readline from 'readline';
|
|
24
24
|
import { getClient } from './api-client.js';
|
|
25
25
|
import { loadFeltDBConfig, createDefaultConfig, validateModel, } from './config.js';
|
|
26
|
-
const VERSION = '0.6.
|
|
26
|
+
const VERSION = '0.6.12';
|
|
27
27
|
function prompt(question) {
|
|
28
28
|
const rl = readline.createInterface({
|
|
29
29
|
input: process.stdin,
|
|
@@ -176,11 +176,16 @@ export function startPairingDiscoveryServer(token, port = 7799, host = '127.0.0.
|
|
|
176
176
|
return;
|
|
177
177
|
}
|
|
178
178
|
response.setHeader('Content-Type', 'application/json; charset=utf-8');
|
|
179
|
+
const activeRuntime = runtimeSession
|
|
180
|
+
? activeRegistrations().sort((left, right) => right.lastSeenAt - left.lastSeenAt)[0]
|
|
181
|
+
: undefined;
|
|
179
182
|
response.end(JSON.stringify({
|
|
180
183
|
workspaceId: token.workspaceId,
|
|
181
184
|
endpoint: authorityEndpoint,
|
|
182
185
|
expiresAt: token.expiresAt,
|
|
183
186
|
namespace: token.namespace,
|
|
187
|
+
sessionId: runtimeSession?.sessionId,
|
|
188
|
+
runtimeInstanceId: activeRuntime?.runtimeInstanceId,
|
|
184
189
|
}));
|
|
185
190
|
}
|
|
186
191
|
catch (error) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// One release train keeps generated applications installable. The repository
|
|
2
2
|
// validation script checks these values against every workspace manifest.
|
|
3
|
-
export const FELTDB_PACKAGE_VERSION = '0.6.
|
|
3
|
+
export const FELTDB_PACKAGE_VERSION = '0.6.12';
|
|
4
4
|
export const feltdbPackageRange = `^${FELTDB_PACKAGE_VERSION}`;
|
|
@@ -16,7 +16,7 @@ export { startRuntimeObservation } from './runtime-observer.js';
|
|
|
16
16
|
export type { RuntimeObservationOptions, RuntimeObservationHandle } from './runtime-observer.js';
|
|
17
17
|
export { collectEvidence, deriveFinding, candidateSourcePaths, recommendChanges, resolveRelevantSource, verificationContractFor, summarizeDefect, } from './investigation-analysis.js';
|
|
18
18
|
export { RUNTIME_INVESTIGATION_COLLECTION, LEGACY_RUNTIME_INVESTIGATION_COLLECTION, transitionInvestigation, transitionRemediation, transitionVerification, createRemediationContract, classifyWorkspaceActivity, evaluateVerification, agentRemediationHandoff, RUNTIME_INVESTIGATION_INSTRUCTIONS, FELTDB_OBSERVATION_BOUNDARY, } from './runtime-investigation.js';
|
|
19
|
-
export type { WorkspaceConnectionOptions, WorkspaceMetadata, PairingTokenData, BrowserPairingResolution, PairingDiscoveryOptions, ClientInfo, } from './workspace-connection.js';
|
|
19
|
+
export type { WorkspaceConnectionOptions, WorkspaceMetadata, PairingTokenData, BrowserPairingResolution, PairingDiscoveryOptions, ClientInfo, CreateRuntimeInvestigationInput, } from './workspace-connection.js';
|
|
20
20
|
export { connectDevelopmentWorkspace, discoverDevelopmentWorkspace, resolvePairingCode, DevelopmentWorkspaceConnection, } from './workspace-connection.js';
|
|
21
21
|
export { createWorkspaceId, isValidWorkspaceId, createDevelopmentWorkspace, updateWorkspaceTimestamp, discoverWorkspace, persistWorkspaceDiscovery, } from './workspace-identity.js';
|
|
22
22
|
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/workspace/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,YAAY,EACV,oBAAoB,EACpB,UAAU,EACV,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,6BAA6B,EAC7B,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,qBAAqB,EACrB,SAAS,EACT,aAAa,EACb,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,YAAY,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEjG,OAAO,EACL,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,gCAAgC,EAChC,uCAAuC,EACvC,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,kCAAkC,EAClC,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EACV,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,UAAU,
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/workspace/browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,YAAY,EACV,oBAAoB,EACpB,UAAU,EACV,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,6BAA6B,EAC7B,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,qBAAqB,EACrB,SAAS,EACT,aAAa,EACb,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,YAAY,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEjG,OAAO,EACL,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,gCAAgC,EAChC,uCAAuC,EACvC,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,kCAAkC,EAClC,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EACV,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,UAAU,EACV,+BAA+B,GAChC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,kBAAkB,EAClB,8BAA8B,GAC/B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC"}
|
|
@@ -21,7 +21,7 @@ export { captureRepositoryIdentity, changedPaths, repositoryChanged, trackRemedi
|
|
|
21
21
|
export { RuntimeInvestigationSupervisor } from './investigation-supervisor.js';
|
|
22
22
|
export type { SupervisorOptions, AgentHandoffArtifact } from './investigation-supervisor.js';
|
|
23
23
|
export { RUNTIME_INVESTIGATION_COLLECTION, LEGACY_RUNTIME_INVESTIGATION_COLLECTION, transitionInvestigation, transitionRemediation, transitionVerification, createRemediationContract, classifyWorkspaceActivity, evaluateVerification, agentRemediationHandoff, RUNTIME_INVESTIGATION_INSTRUCTIONS, FELTDB_OBSERVATION_BOUNDARY, } from './runtime-investigation.js';
|
|
24
|
-
export type { WorkspaceConnectionOptions, WorkspaceMetadata, PairingTokenData, BrowserPairingResolution, PairingDiscoveryOptions, ClientInfo, } from './workspace-connection.js';
|
|
24
|
+
export type { WorkspaceConnectionOptions, WorkspaceMetadata, PairingTokenData, BrowserPairingResolution, PairingDiscoveryOptions, ClientInfo, CreateRuntimeInvestigationInput, } from './workspace-connection.js';
|
|
25
25
|
export { connectDevelopmentWorkspace, discoverDevelopmentWorkspace, resolvePairingCode, DevelopmentWorkspaceConnection, } from './workspace-connection.js';
|
|
26
26
|
export { createWorkspaceId, isValidWorkspaceId, createDevelopmentWorkspace, updateWorkspaceTimestamp, discoverWorkspace, persistWorkspaceDiscovery, } from './workspace-identity.js';
|
|
27
27
|
export { DevelopmentNode, getDevelopmentNode, shutdownDevelopmentNode, } from './development-node.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workspace/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,YAAY,EACV,oBAAoB,EACpB,UAAU,EACV,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,6BAA6B,EAC7B,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,qBAAqB,EACrB,SAAS,EACT,aAAa,EACb,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,YAAY,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEjG,OAAO,EACL,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,yBAAyB,EACzB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAC/E,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAE7F,OAAO,EACL,gCAAgC,EAChC,uCAAuC,EACvC,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,kCAAkC,EAClC,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EACV,0BAA0B,EAC1B,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/workspace/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,YAAY,EACV,oBAAoB,EACpB,UAAU,EACV,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,6BAA6B,EAC7B,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,qBAAqB,EACrB,SAAS,EACT,aAAa,EACb,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,YAAY,EAAE,yBAAyB,EAAE,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AAM,sCAAsC,CAAC;AACrF,YAAY,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC"}
|
|
@@ -76,8 +76,8 @@ export async function startRuntimeObservation(options) {
|
|
|
76
76
|
startedAt: input.startedAt,
|
|
77
77
|
completedAt,
|
|
78
78
|
workspaceId: connection.workspaceId,
|
|
79
|
-
sessionId: options.sessionId,
|
|
80
|
-
runtimeInstanceId: options.runtimeInstanceId,
|
|
79
|
+
sessionId: options.sessionId || connection.sessionId,
|
|
80
|
+
runtimeInstanceId: options.runtimeInstanceId || connection.runtimeInstanceId,
|
|
81
81
|
page: scope.location ? String(scope.location.href) : undefined,
|
|
82
82
|
userAgent: scope.navigator ? String(scope.navigator.userAgent) : undefined,
|
|
83
83
|
correlationId: input.correlationId,
|
|
@@ -245,8 +245,8 @@ export async function startRuntimeObservation(options) {
|
|
|
245
245
|
};
|
|
246
246
|
const handle = {
|
|
247
247
|
workspaceId: connection.workspaceId,
|
|
248
|
-
sessionId: options.sessionId,
|
|
249
|
-
runtimeInstanceId: options.runtimeInstanceId,
|
|
248
|
+
sessionId: options.sessionId || connection.sessionId,
|
|
249
|
+
runtimeInstanceId: options.runtimeInstanceId || connection.runtimeInstanceId,
|
|
250
250
|
observations: () => [...emitted],
|
|
251
251
|
flush,
|
|
252
252
|
stop: async () => {
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Public API for clients (browser, IDE, agent) to discover and connect
|
|
5
5
|
* to a FeltDB Development Workspace.
|
|
6
6
|
*/
|
|
7
|
-
import type { ClientType } from './workspace-types.js';
|
|
7
|
+
import type { ClientType, RuntimeInvestigation, RuntimeRequestObservation } from './workspace-types.js';
|
|
8
8
|
import type { WorkspaceEventPayload } from './workspace-types.js';
|
|
9
|
+
import { type RuntimeObservationInput } from './runtime-observation.js';
|
|
9
10
|
export interface WorkspaceConnectionOptions {
|
|
10
11
|
pairingCode?: string;
|
|
11
12
|
workspaceId?: string;
|
|
@@ -14,6 +15,10 @@ export interface WorkspaceConnectionOptions {
|
|
|
14
15
|
clientType?: ClientType;
|
|
15
16
|
endpoint?: string;
|
|
16
17
|
discoveryEndpoint?: string;
|
|
18
|
+
/** Development-session identity supplied by FeltDB, never derived locally. */
|
|
19
|
+
sessionId?: string;
|
|
20
|
+
/** Runtime registration identity supplied by FeltDB, never derived locally. */
|
|
21
|
+
runtimeInstanceId?: string;
|
|
17
22
|
auth?: {
|
|
18
23
|
token: string;
|
|
19
24
|
apiKey?: string;
|
|
@@ -31,12 +36,22 @@ export interface PairingTokenData {
|
|
|
31
36
|
endpoint?: string;
|
|
32
37
|
authorityEndpoint?: string;
|
|
33
38
|
namespace?: string;
|
|
39
|
+
sessionId?: string;
|
|
40
|
+
runtimeInstanceId?: string;
|
|
34
41
|
}
|
|
35
42
|
export interface BrowserPairingResolution {
|
|
36
43
|
workspaceId: string;
|
|
37
44
|
endpoint: string;
|
|
38
45
|
expiresAt: number;
|
|
39
46
|
namespace: string;
|
|
47
|
+
sessionId?: string;
|
|
48
|
+
runtimeInstanceId?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface CreateRuntimeInvestigationInput {
|
|
51
|
+
investigationId?: string;
|
|
52
|
+
observationId: string;
|
|
53
|
+
changeId?: string;
|
|
54
|
+
verificationId?: string;
|
|
40
55
|
}
|
|
41
56
|
export interface PairingDiscoveryOptions {
|
|
42
57
|
endpoint?: string;
|
|
@@ -112,6 +127,10 @@ export declare function connectDevelopmentWorkspace(options: WorkspaceConnection
|
|
|
112
127
|
*/
|
|
113
128
|
export declare class DevelopmentWorkspaceConnection {
|
|
114
129
|
workspaceId: string;
|
|
130
|
+
/** Canonical `feltdb dev` session identity, when supplied by pairing/session configuration. */
|
|
131
|
+
sessionId?: string;
|
|
132
|
+
/** Canonical active runtime identity, when supplied by pairing/session configuration. */
|
|
133
|
+
runtimeInstanceId?: string;
|
|
115
134
|
clientId: string;
|
|
116
135
|
clientType: ClientType;
|
|
117
136
|
private options;
|
|
@@ -161,6 +180,19 @@ export declare class DevelopmentWorkspaceConnection {
|
|
|
161
180
|
* Query entities in workspace collection
|
|
162
181
|
*/
|
|
163
182
|
query<T>(collection: string): Promise<T[]>;
|
|
183
|
+
/** Record a redacted canonical observation under its FeltDB observation id. */
|
|
184
|
+
recordRuntimeObservation(input: RuntimeObservationInput): Promise<RuntimeRequestObservation>;
|
|
185
|
+
getRuntimeObservation(observationId: string): Promise<RuntimeRequestObservation | null>;
|
|
186
|
+
/** Create the canonical shared-workspace investigation for an existing observation. */
|
|
187
|
+
createRuntimeInvestigation(input: CreateRuntimeInvestigationInput): Promise<RuntimeInvestigation>;
|
|
188
|
+
getRuntimeInvestigation(investigationId: string): Promise<RuntimeInvestigation | null>;
|
|
189
|
+
linkRuntimeObservationToInvestigation(observationId: string, investigationId: string): Promise<RuntimeInvestigation>;
|
|
190
|
+
getRuntimeInvestigationForObservation(observationId: string): Promise<RuntimeInvestigation | null>;
|
|
191
|
+
linkRuntimeInvestigation(input: {
|
|
192
|
+
investigationId: string;
|
|
193
|
+
changeId?: string;
|
|
194
|
+
verificationId?: string;
|
|
195
|
+
}): Promise<RuntimeInvestigation>;
|
|
164
196
|
/**
|
|
165
197
|
* Update entity in workspace
|
|
166
198
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-connection.d.ts","sourceRoot":"","sources":["../../src/workspace/workspace-connection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"workspace-connection.d.ts","sourceRoot":"","sources":["../../src/workspace/workspace-connection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,0BAA0B,CAAC;AAGlC,MAAM,WAAW,0BAA0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AAM,GACtB,OAAO,CAAC,oBAAoB,CAAC;IA2B1B,qCAAqC,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAOlG,wBAAwB,CAAC,KAAK,EAAE;QACpC,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAYjC;;OAEG;IACG,MAAM,CAAC,CAAC,SAAS,MAAM,EAC3B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAClB,OAAO,CAAC,IAAI,CAAC;IAUhB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,gBAAgB;YAKV,eAAe;CAiB9B"}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* to a FeltDB Development Workspace.
|
|
6
6
|
*/
|
|
7
7
|
import { HttpJsDb } from '../http-db.js';
|
|
8
|
+
import { RUNTIME_OBSERVATION_COLLECTION, createRuntimeObservation, } from './runtime-observation.js';
|
|
9
|
+
import { RUNTIME_INVESTIGATION_COLLECTION } from './runtime-investigation.js';
|
|
8
10
|
const DEFAULT_PAIRING_DISCOVERY_ENDPOINT = 'http://127.0.0.1:7799';
|
|
9
11
|
/**
|
|
10
12
|
* Discover workspace from .feltdb/workspace.json
|
|
@@ -117,6 +119,8 @@ export async function resolvePairingCode(pairingCode, source = {}) {
|
|
|
117
119
|
export async function connectDevelopmentWorkspace(options) {
|
|
118
120
|
let workspaceId = options.workspaceId;
|
|
119
121
|
let authorityEndpoint = options.endpoint;
|
|
122
|
+
let sessionId = options.sessionId;
|
|
123
|
+
let runtimeInstanceId = options.runtimeInstanceId;
|
|
120
124
|
// Resolve pairing code to workspace ID if provided
|
|
121
125
|
if (options.pairingCode && !workspaceId) {
|
|
122
126
|
if (options.projectDir) {
|
|
@@ -128,6 +132,8 @@ export async function connectDevelopmentWorkspace(options) {
|
|
|
128
132
|
});
|
|
129
133
|
workspaceId = resolution.workspaceId;
|
|
130
134
|
authorityEndpoint = resolution.endpoint;
|
|
135
|
+
sessionId = resolution.sessionId;
|
|
136
|
+
runtimeInstanceId = resolution.runtimeInstanceId;
|
|
131
137
|
}
|
|
132
138
|
}
|
|
133
139
|
// Discover workspace if no ID provided
|
|
@@ -140,7 +146,7 @@ export async function connectDevelopmentWorkspace(options) {
|
|
|
140
146
|
}
|
|
141
147
|
const clientId = options.clientId || generateClientId(options.clientType);
|
|
142
148
|
const clientType = options.clientType || 'other';
|
|
143
|
-
const connection = new DevelopmentWorkspaceConnection(workspaceId, clientId, clientType, { ...options, endpoint: authorityEndpoint });
|
|
149
|
+
const connection = new DevelopmentWorkspaceConnection(workspaceId, clientId, clientType, { ...options, endpoint: authorityEndpoint, sessionId, runtimeInstanceId });
|
|
144
150
|
await connection.connect();
|
|
145
151
|
return connection;
|
|
146
152
|
}
|
|
@@ -166,6 +172,8 @@ export class DevelopmentWorkspaceConnection {
|
|
|
166
172
|
this.transport = null;
|
|
167
173
|
this.unsubscribeEvents = null;
|
|
168
174
|
this.workspaceId = workspaceId;
|
|
175
|
+
this.sessionId = options.sessionId;
|
|
176
|
+
this.runtimeInstanceId = options.runtimeInstanceId;
|
|
169
177
|
this.clientId = clientId;
|
|
170
178
|
this.clientType = clientType;
|
|
171
179
|
this.options = options;
|
|
@@ -264,7 +272,12 @@ export class DevelopmentWorkspaceConnection {
|
|
|
264
272
|
* Creates new entity in workspace collection.
|
|
265
273
|
*/
|
|
266
274
|
async publish(collection, entity) {
|
|
267
|
-
const
|
|
275
|
+
const canonicalId = collection === RUNTIME_OBSERVATION_COLLECTION
|
|
276
|
+
? entity.observationId
|
|
277
|
+
: collection === RUNTIME_INVESTIGATION_COLLECTION
|
|
278
|
+
? entity.id
|
|
279
|
+
: undefined;
|
|
280
|
+
const id = canonicalId || generateEntityId();
|
|
268
281
|
await this.requireTransport().publish({
|
|
269
282
|
workspaceId: this.workspaceId,
|
|
270
283
|
collection,
|
|
@@ -286,6 +299,108 @@ export class DevelopmentWorkspaceConnection {
|
|
|
286
299
|
async query(collection) {
|
|
287
300
|
return this.requireTransport().query({ workspaceId: this.workspaceId, collection });
|
|
288
301
|
}
|
|
302
|
+
/** Record a redacted canonical observation under its FeltDB observation id. */
|
|
303
|
+
async recordRuntimeObservation(input) {
|
|
304
|
+
if (!this.sessionId || !this.runtimeInstanceId) {
|
|
305
|
+
throw new Error('Canonical runtime observation requires FeltDB sessionId and runtimeInstanceId');
|
|
306
|
+
}
|
|
307
|
+
const observation = createRuntimeObservation({
|
|
308
|
+
...input,
|
|
309
|
+
workspaceId: this.workspaceId,
|
|
310
|
+
sessionId: this.sessionId,
|
|
311
|
+
runtimeInstanceId: this.runtimeInstanceId,
|
|
312
|
+
});
|
|
313
|
+
await this.requireTransport().publish({
|
|
314
|
+
workspaceId: this.workspaceId,
|
|
315
|
+
collection: RUNTIME_OBSERVATION_COLLECTION,
|
|
316
|
+
entityId: observation.observationId,
|
|
317
|
+
value: observation,
|
|
318
|
+
originClientId: this.clientId,
|
|
319
|
+
});
|
|
320
|
+
return observation;
|
|
321
|
+
}
|
|
322
|
+
async getRuntimeObservation(observationId) {
|
|
323
|
+
return this.get(RUNTIME_OBSERVATION_COLLECTION, observationId);
|
|
324
|
+
}
|
|
325
|
+
/** Create the canonical shared-workspace investigation for an existing observation. */
|
|
326
|
+
async createRuntimeInvestigation(input) {
|
|
327
|
+
const observation = await this.getRuntimeObservation(input.observationId);
|
|
328
|
+
if (!observation)
|
|
329
|
+
throw new Error(`Runtime observation not found: ${input.observationId}`);
|
|
330
|
+
const now = Date.now();
|
|
331
|
+
const investigation = {
|
|
332
|
+
id: input.investigationId || `inv_${now}_${Math.random().toString(36).slice(2, 9)}`,
|
|
333
|
+
workspaceId: this.workspaceId,
|
|
334
|
+
observationId: observation.observationId,
|
|
335
|
+
observationIds: [observation.observationId],
|
|
336
|
+
runtimeInstanceId: observation.runtimeInstanceId,
|
|
337
|
+
sessionId: observation.sessionId,
|
|
338
|
+
changeId: input.changeId,
|
|
339
|
+
verificationId: input.verificationId,
|
|
340
|
+
remediationContractId: '',
|
|
341
|
+
investigationState: 'OBSERVED',
|
|
342
|
+
remediationState: 'NOT_STARTED',
|
|
343
|
+
verificationState: 'NOT_READY',
|
|
344
|
+
createdAt: now,
|
|
345
|
+
updatedAt: now,
|
|
346
|
+
};
|
|
347
|
+
await this.requireTransport().publish({
|
|
348
|
+
workspaceId: this.workspaceId,
|
|
349
|
+
collection: RUNTIME_INVESTIGATION_COLLECTION,
|
|
350
|
+
entityId: investigation.id,
|
|
351
|
+
value: investigation,
|
|
352
|
+
originClientId: this.clientId,
|
|
353
|
+
});
|
|
354
|
+
return investigation;
|
|
355
|
+
}
|
|
356
|
+
async getRuntimeInvestigation(investigationId) {
|
|
357
|
+
return this.get(RUNTIME_INVESTIGATION_COLLECTION, investigationId);
|
|
358
|
+
}
|
|
359
|
+
async linkRuntimeObservationToInvestigation(observationId, investigationId) {
|
|
360
|
+
const [observation, investigation] = await Promise.all([
|
|
361
|
+
this.getRuntimeObservation(observationId),
|
|
362
|
+
this.getRuntimeInvestigation(investigationId),
|
|
363
|
+
]);
|
|
364
|
+
if (!observation)
|
|
365
|
+
throw new Error(`Runtime observation not found: ${observationId}`);
|
|
366
|
+
if (!investigation)
|
|
367
|
+
throw new Error(`Runtime investigation not found: ${investigationId}`);
|
|
368
|
+
if (observation.workspaceId !== this.workspaceId || investigation.workspaceId !== this.workspaceId) {
|
|
369
|
+
throw new Error('Runtime observation and investigation must belong to the connected workspace');
|
|
370
|
+
}
|
|
371
|
+
const owner = await this.getRuntimeInvestigationForObservation(observationId);
|
|
372
|
+
if (owner && owner.id !== investigationId) {
|
|
373
|
+
throw new Error(`Runtime observation ${observationId} is already linked to ${owner.id}`);
|
|
374
|
+
}
|
|
375
|
+
const observationIds = [...new Set([
|
|
376
|
+
investigation.observationId,
|
|
377
|
+
...(investigation.observationIds || []),
|
|
378
|
+
observationId,
|
|
379
|
+
])];
|
|
380
|
+
const updatedAt = Date.now();
|
|
381
|
+
await this.update(RUNTIME_INVESTIGATION_COLLECTION, investigationId, {
|
|
382
|
+
observationIds,
|
|
383
|
+
updatedAt,
|
|
384
|
+
});
|
|
385
|
+
return { ...investigation, observationIds, updatedAt };
|
|
386
|
+
}
|
|
387
|
+
async getRuntimeInvestigationForObservation(observationId) {
|
|
388
|
+
const investigations = await this.query(RUNTIME_INVESTIGATION_COLLECTION);
|
|
389
|
+
return investigations.find(investigation => investigation.observationId === observationId
|
|
390
|
+
|| investigation.observationIds?.includes(observationId)) || null;
|
|
391
|
+
}
|
|
392
|
+
async linkRuntimeInvestigation(input) {
|
|
393
|
+
const investigation = await this.getRuntimeInvestigation(input.investigationId);
|
|
394
|
+
if (!investigation)
|
|
395
|
+
throw new Error(`Runtime investigation not found: ${input.investigationId}`);
|
|
396
|
+
const updates = {
|
|
397
|
+
...(input.changeId ? { changeId: input.changeId } : {}),
|
|
398
|
+
...(input.verificationId ? { verificationId: input.verificationId } : {}),
|
|
399
|
+
updatedAt: Date.now(),
|
|
400
|
+
};
|
|
401
|
+
await this.update(RUNTIME_INVESTIGATION_COLLECTION, investigation.id, updates);
|
|
402
|
+
return { ...investigation, ...updates };
|
|
403
|
+
}
|
|
289
404
|
/**
|
|
290
405
|
* Update entity in workspace
|
|
291
406
|
*/
|
package/package.json
CHANGED