forkit-connect 0.1.4 → 0.1.6
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/QUICKSTART.md +10 -1
- package/README.md +12 -1
- package/dist/cli.js +774 -40
- package/dist/launcher.js +471 -73
- package/dist/resource-meter.d.ts +15 -0
- package/dist/resource-meter.js +60 -0
- package/dist/v1/api.d.ts +41 -0
- package/dist/v1/api.js +57 -0
- package/dist/v1/daemon.js +9 -0
- package/dist/v1/repo-discovery.d.ts +42 -0
- package/dist/v1/repo-discovery.js +206 -0
- package/dist/v1/runtime-activity.d.ts +55 -0
- package/dist/v1/runtime-activity.js +388 -0
- package/dist/v1/runtime-context.d.ts +18 -0
- package/dist/v1/runtime-context.js +96 -0
- package/dist/v1/runtime-editor-activity.d.ts +47 -0
- package/dist/v1/runtime-editor-activity.js +821 -0
- package/dist/v1/runtime-observation-runner.d.ts +49 -0
- package/dist/v1/runtime-observation-runner.js +508 -0
- package/dist/v1/runtime-observer.d.ts +50 -0
- package/dist/v1/runtime-observer.js +867 -0
- package/dist/v1/runtime-registration.d.ts +58 -0
- package/dist/v1/runtime-registration.js +319 -0
- package/dist/v1/service.d.ts +44 -1
- package/dist/v1/service.js +166 -11
- package/dist/v1/state.d.ts +4 -1
- package/dist/v1/state.js +28 -0
- package/dist/v1/types.d.ts +14 -0
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type RuntimeRegistrationSubjectType = 'git_worktree' | 'git_repository' | 'service_root' | 'container_runtime' | 'other';
|
|
2
|
+
export interface RuntimeToolingHint {
|
|
3
|
+
key: 'antigravity' | 'cursor' | 'vscode' | 'claude' | 'anaconda' | 'jupyter';
|
|
4
|
+
label: string;
|
|
5
|
+
detectedBy: Array<'env' | 'binary' | 'workspace'>;
|
|
6
|
+
}
|
|
7
|
+
export interface RuntimeProjectSnapshot {
|
|
8
|
+
cwd: string;
|
|
9
|
+
repoRoot: string;
|
|
10
|
+
repoRootName: string;
|
|
11
|
+
sourceUrl: string | null;
|
|
12
|
+
subjectType: RuntimeRegistrationSubjectType;
|
|
13
|
+
branch: string | null;
|
|
14
|
+
commit: string | null;
|
|
15
|
+
dirty: boolean;
|
|
16
|
+
relativeEntrypoint: string;
|
|
17
|
+
repoRootFingerprint: string;
|
|
18
|
+
repoRemoteFingerprint: string | null;
|
|
19
|
+
worktreeId: string;
|
|
20
|
+
detectedTooling: RuntimeToolingHint[];
|
|
21
|
+
}
|
|
22
|
+
export interface RuntimeRegistrationDraft {
|
|
23
|
+
name: string;
|
|
24
|
+
description: string | null;
|
|
25
|
+
sourceUrl: string | null;
|
|
26
|
+
runtimeIdentity: {
|
|
27
|
+
contractVersion: 'runtime.identity.v1';
|
|
28
|
+
subjectType: RuntimeRegistrationSubjectType;
|
|
29
|
+
subjectLabel: string;
|
|
30
|
+
repoRootFingerprint: string;
|
|
31
|
+
repoRemoteFingerprint?: string;
|
|
32
|
+
worktreeId: string;
|
|
33
|
+
entrypointRelativePath: string;
|
|
34
|
+
deploymentEnvironment: string;
|
|
35
|
+
};
|
|
36
|
+
metadata: Record<string, unknown>;
|
|
37
|
+
snapshot: RuntimeProjectSnapshot;
|
|
38
|
+
}
|
|
39
|
+
export interface RuntimeRegistrationOptions {
|
|
40
|
+
cwd?: string;
|
|
41
|
+
name?: string | null;
|
|
42
|
+
description?: string | null;
|
|
43
|
+
sourceUrl?: string | null;
|
|
44
|
+
entrypointRelativePath?: string | null;
|
|
45
|
+
subjectType?: RuntimeRegistrationSubjectType | null;
|
|
46
|
+
deploymentEnvironment?: string | null;
|
|
47
|
+
connectRuntimeId?: string | null;
|
|
48
|
+
}
|
|
49
|
+
declare function normalizeSourceUrl(raw: string | null | undefined): string | null;
|
|
50
|
+
declare function sanitizeRuntimeName(value: string, maxLength?: number): string;
|
|
51
|
+
export declare function buildRuntimeRegistrationDraft(snapshot: RuntimeProjectSnapshot, options?: Omit<RuntimeRegistrationOptions, 'cwd'>): RuntimeRegistrationDraft;
|
|
52
|
+
export declare function inspectRuntimeProject(options?: RuntimeRegistrationOptions): RuntimeRegistrationDraft;
|
|
53
|
+
export declare const __private__: {
|
|
54
|
+
normalizeSourceUrl: typeof normalizeSourceUrl;
|
|
55
|
+
sanitizeRuntimeName: typeof sanitizeRuntimeName;
|
|
56
|
+
};
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=runtime-registration.d.ts.map
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.__private__ = void 0;
|
|
7
|
+
exports.buildRuntimeRegistrationDraft = buildRuntimeRegistrationDraft;
|
|
8
|
+
exports.inspectRuntimeProject = inspectRuntimeProject;
|
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
+
const node_child_process_1 = require("node:child_process");
|
|
12
|
+
const node_crypto_1 = require("node:crypto");
|
|
13
|
+
const DEFAULT_DEPLOYMENT_ENVIRONMENT = 'device-local';
|
|
14
|
+
const SURFACE_CONTRACT_VERSION = 'passport.surface.v1';
|
|
15
|
+
const RUNTIME_IDENTITY_VERSION = 'runtime.identity.v1';
|
|
16
|
+
const RUNTIME_SUBJECT_TYPES = new Set([
|
|
17
|
+
'git_worktree',
|
|
18
|
+
'git_repository',
|
|
19
|
+
'service_root',
|
|
20
|
+
'container_runtime',
|
|
21
|
+
'other',
|
|
22
|
+
]);
|
|
23
|
+
const TOOLING_DEFINITIONS = [
|
|
24
|
+
{
|
|
25
|
+
key: 'antigravity',
|
|
26
|
+
label: 'Antigravity',
|
|
27
|
+
binaries: ['antigravity'],
|
|
28
|
+
envKeys: ['ANTIGRAVITY_HOME', 'ANTIGRAVITY_PROJECT'],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
key: 'cursor',
|
|
32
|
+
label: 'Cursor',
|
|
33
|
+
binaries: ['cursor'],
|
|
34
|
+
workspaceMarkers: ['.cursor'],
|
|
35
|
+
envValues: ['cursor'],
|
|
36
|
+
envKeys: ['CURSOR_TRACE_ID', 'CURSOR_CONFIG_HOME'],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: 'vscode',
|
|
40
|
+
label: 'VS Code',
|
|
41
|
+
binaries: ['code', 'codium'],
|
|
42
|
+
workspaceMarkers: ['.vscode'],
|
|
43
|
+
envValues: ['vscode'],
|
|
44
|
+
envKeys: ['VSCODE_GIT_IPC_HANDLE', 'VSCODE_IPC_HOOK_CLI'],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key: 'claude',
|
|
48
|
+
label: 'Claude',
|
|
49
|
+
binaries: ['claude'],
|
|
50
|
+
envKeys: ['CLAUDECODE', 'CLAUDE_CODE_ENTRYPOINT'],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: 'anaconda',
|
|
54
|
+
label: 'Anaconda',
|
|
55
|
+
binaries: ['conda'],
|
|
56
|
+
envKeys: ['CONDA_PREFIX', 'CONDA_DEFAULT_ENV'],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
key: 'jupyter',
|
|
60
|
+
label: 'Jupyter',
|
|
61
|
+
binaries: ['jupyter', 'jupyter-lab', 'jupyter-notebook'],
|
|
62
|
+
envKeys: ['JPY_PARENT_PID', 'JUPYTERHUB_API_TOKEN'],
|
|
63
|
+
fileSuffixes: ['.ipynb'],
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
function hashHex(value) {
|
|
67
|
+
return (0, node_crypto_1.createHash)('sha256').update(value, 'utf8').digest('hex');
|
|
68
|
+
}
|
|
69
|
+
function trimOptional(value) {
|
|
70
|
+
const normalized = String(value ?? '').trim();
|
|
71
|
+
return normalized.length ? normalized : null;
|
|
72
|
+
}
|
|
73
|
+
function realpathSafe(value) {
|
|
74
|
+
const resolved = node_path_1.default.resolve(value);
|
|
75
|
+
try {
|
|
76
|
+
const nativeRealpath = node_fs_1.default.realpathSync.native;
|
|
77
|
+
return typeof nativeRealpath === 'function' ? nativeRealpath(resolved) : node_fs_1.default.realpathSync(resolved);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return resolved;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function runGit(cwd, args) {
|
|
84
|
+
const result = (0, node_child_process_1.spawnSync)('git', args, {
|
|
85
|
+
cwd,
|
|
86
|
+
encoding: 'utf8',
|
|
87
|
+
timeout: 1500,
|
|
88
|
+
});
|
|
89
|
+
if (result.error || result.status !== 0) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
return trimOptional(result.stdout);
|
|
93
|
+
}
|
|
94
|
+
function commandExists(command) {
|
|
95
|
+
const runner = process.platform === 'win32' ? 'where' : 'which';
|
|
96
|
+
const result = (0, node_child_process_1.spawnSync)(runner, [command], {
|
|
97
|
+
encoding: 'utf8',
|
|
98
|
+
timeout: 1000,
|
|
99
|
+
});
|
|
100
|
+
return !result.error && result.status === 0;
|
|
101
|
+
}
|
|
102
|
+
function safeStatEntry(targetPath) {
|
|
103
|
+
try {
|
|
104
|
+
return node_fs_1.default.existsSync(targetPath);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function normalizeRelativePath(value, repoRoot, cwd) {
|
|
111
|
+
const normalized = trimOptional(value);
|
|
112
|
+
if (!normalized) {
|
|
113
|
+
const relative = node_path_1.default.relative(repoRoot, cwd).replace(/\\/g, '/');
|
|
114
|
+
return relative.length ? relative : '.';
|
|
115
|
+
}
|
|
116
|
+
if (node_path_1.default.isAbsolute(normalized) || normalized.startsWith('~') || /^[A-Za-z]:[\\/]/.test(normalized)) {
|
|
117
|
+
throw new Error('Entrypoint must be relative to the runtime root.');
|
|
118
|
+
}
|
|
119
|
+
const cleaned = node_path_1.default.posix.normalize(normalized.replace(/\\/g, '/'));
|
|
120
|
+
if (cleaned.startsWith('../')) {
|
|
121
|
+
throw new Error('Entrypoint cannot point outside the runtime root.');
|
|
122
|
+
}
|
|
123
|
+
return cleaned === '' ? '.' : cleaned;
|
|
124
|
+
}
|
|
125
|
+
function normalizeSourceUrl(raw) {
|
|
126
|
+
const value = trimOptional(raw);
|
|
127
|
+
if (!value)
|
|
128
|
+
return null;
|
|
129
|
+
if (/^https?:\/\//i.test(value)) {
|
|
130
|
+
try {
|
|
131
|
+
const parsed = new URL(value);
|
|
132
|
+
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
parsed.hash = '';
|
|
136
|
+
return parsed.toString().replace(/\.git$/i, '');
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const scpMatch = value.match(/^git@([^:]+):(.+)$/i);
|
|
143
|
+
if (scpMatch) {
|
|
144
|
+
return `https://${scpMatch[1]}/${String(scpMatch[2] || '').replace(/\.git$/i, '')}`;
|
|
145
|
+
}
|
|
146
|
+
const sshMatch = value.match(/^ssh:\/\/git@([^/]+)\/(.+)$/i);
|
|
147
|
+
if (sshMatch) {
|
|
148
|
+
return `https://${sshMatch[1]}/${String(sshMatch[2] || '').replace(/\.git$/i, '')}`;
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
function slugifyRuntimeLabel(value, maxLength = 80) {
|
|
153
|
+
const normalized = value
|
|
154
|
+
.trim()
|
|
155
|
+
.replace(/[\\/]+/g, '-')
|
|
156
|
+
.replace(/[^a-zA-Z0-9._-]+/g, '-')
|
|
157
|
+
.replace(/-{2,}/g, '-')
|
|
158
|
+
.replace(/^-+|-+$/g, '');
|
|
159
|
+
return (normalized || 'runtime').slice(0, maxLength);
|
|
160
|
+
}
|
|
161
|
+
function sanitizeRuntimeName(value, maxLength = 120) {
|
|
162
|
+
const normalized = value
|
|
163
|
+
.trim()
|
|
164
|
+
.replace(/[\\/]+/g, ' - ')
|
|
165
|
+
.replace(/[^a-zA-Z0-9 _\-().]+/g, ' ')
|
|
166
|
+
.replace(/\s{2,}/g, ' ')
|
|
167
|
+
.trim();
|
|
168
|
+
const trimmed = normalized.slice(0, maxLength).trim();
|
|
169
|
+
if (trimmed.length < 2) {
|
|
170
|
+
throw new Error('Runtime name must be at least 2 supported characters.');
|
|
171
|
+
}
|
|
172
|
+
return trimmed;
|
|
173
|
+
}
|
|
174
|
+
function chooseSubjectType(input, isGitRepo) {
|
|
175
|
+
const normalized = trimOptional(input);
|
|
176
|
+
if (!normalized) {
|
|
177
|
+
return isGitRepo ? 'git_worktree' : 'service_root';
|
|
178
|
+
}
|
|
179
|
+
if (!RUNTIME_SUBJECT_TYPES.has(normalized)) {
|
|
180
|
+
throw new Error(`Unsupported runtime subject type: ${normalized}`);
|
|
181
|
+
}
|
|
182
|
+
return normalized;
|
|
183
|
+
}
|
|
184
|
+
function detectTooling(repoRoot, cwd) {
|
|
185
|
+
const rootEntries = safeStatEntry(repoRoot) ? node_fs_1.default.readdirSync(repoRoot, { withFileTypes: true }) : [];
|
|
186
|
+
const cwdEntries = cwd !== repoRoot && safeStatEntry(cwd) ? node_fs_1.default.readdirSync(cwd, { withFileTypes: true }) : [];
|
|
187
|
+
const termProgram = String(process.env.TERM_PROGRAM || '').trim().toLowerCase();
|
|
188
|
+
return TOOLING_DEFINITIONS.flatMap((definition) => {
|
|
189
|
+
const detectedBy = new Set();
|
|
190
|
+
if (definition.envValues?.some((value) => value === termProgram)) {
|
|
191
|
+
detectedBy.add('env');
|
|
192
|
+
}
|
|
193
|
+
if (definition.envKeys?.some((key) => trimOptional(process.env[key]))) {
|
|
194
|
+
detectedBy.add('env');
|
|
195
|
+
}
|
|
196
|
+
if (definition.binaries?.some((binary) => commandExists(binary))) {
|
|
197
|
+
detectedBy.add('binary');
|
|
198
|
+
}
|
|
199
|
+
if (definition.workspaceMarkers?.some((marker) => safeStatEntry(node_path_1.default.join(repoRoot, marker)) || safeStatEntry(node_path_1.default.join(cwd, marker)))) {
|
|
200
|
+
detectedBy.add('workspace');
|
|
201
|
+
}
|
|
202
|
+
if (definition.fileSuffixes?.some((suffix) => (rootEntries.some((entry) => entry.isFile() && entry.name.endsWith(suffix))
|
|
203
|
+
|| cwdEntries.some((entry) => entry.isFile() && entry.name.endsWith(suffix))))) {
|
|
204
|
+
detectedBy.add('workspace');
|
|
205
|
+
}
|
|
206
|
+
return detectedBy.size
|
|
207
|
+
? [{
|
|
208
|
+
key: definition.key,
|
|
209
|
+
label: definition.label,
|
|
210
|
+
detectedBy: Array.from(detectedBy),
|
|
211
|
+
}]
|
|
212
|
+
: [];
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
function buildRuntimeRegistrationDraft(snapshot, options = {}) {
|
|
216
|
+
const relativeLabel = snapshot.relativeEntrypoint === '.'
|
|
217
|
+
? snapshot.repoRootName
|
|
218
|
+
: `${snapshot.repoRootName} (${snapshot.relativeEntrypoint.replace(/[\\/]+/g, ' - ')})`;
|
|
219
|
+
const name = sanitizeRuntimeName(options.name ? String(options.name) : relativeLabel);
|
|
220
|
+
const description = trimOptional(options.description);
|
|
221
|
+
const explicitSourceUrl = trimOptional(options.sourceUrl);
|
|
222
|
+
const normalizedExplicitSourceUrl = explicitSourceUrl ? normalizeSourceUrl(explicitSourceUrl) : null;
|
|
223
|
+
if (explicitSourceUrl && !normalizedExplicitSourceUrl) {
|
|
224
|
+
throw new Error('Source URL must be a valid http/https or git remote URL.');
|
|
225
|
+
}
|
|
226
|
+
const sourceUrl = normalizedExplicitSourceUrl ?? snapshot.sourceUrl;
|
|
227
|
+
const deploymentEnvironment = trimOptional(options.deploymentEnvironment) ?? DEFAULT_DEPLOYMENT_ENVIRONMENT;
|
|
228
|
+
const subjectLabel = name;
|
|
229
|
+
const connectRuntimeId = trimOptional(options.connectRuntimeId) ?? 'forkit_connect_cli';
|
|
230
|
+
const metadata = {
|
|
231
|
+
surface: {
|
|
232
|
+
controlPlane: 'forkit.dev',
|
|
233
|
+
contractVersion: SURFACE_CONTRACT_VERSION,
|
|
234
|
+
sourceSurface: 'connect_assisted',
|
|
235
|
+
sourceSurfaceInstance: connectRuntimeId,
|
|
236
|
+
sourceSurfaceConfidence: 'observed',
|
|
237
|
+
privacyMode: 'metadata_only',
|
|
238
|
+
attestationMode: 'self_asserted',
|
|
239
|
+
},
|
|
240
|
+
runtimeRegistration: {
|
|
241
|
+
flow: 'forkit_connect_runtime_register_v1',
|
|
242
|
+
connectRuntimeId,
|
|
243
|
+
repoRootName: snapshot.repoRootName,
|
|
244
|
+
branch: snapshot.branch,
|
|
245
|
+
commit: snapshot.commit,
|
|
246
|
+
dirty: snapshot.dirty,
|
|
247
|
+
entrypointRelativePath: snapshot.relativeEntrypoint,
|
|
248
|
+
detectedTooling: snapshot.detectedTooling,
|
|
249
|
+
},
|
|
250
|
+
projectSubjectSeed: {
|
|
251
|
+
subjectType: snapshot.subjectType,
|
|
252
|
+
subjectLabel,
|
|
253
|
+
repoRootName: snapshot.repoRootName,
|
|
254
|
+
repoRootFingerprint: snapshot.repoRootFingerprint,
|
|
255
|
+
repoRemoteFingerprint: snapshot.repoRemoteFingerprint,
|
|
256
|
+
worktreeId: snapshot.worktreeId,
|
|
257
|
+
branch: snapshot.branch,
|
|
258
|
+
commit: snapshot.commit,
|
|
259
|
+
dirty: snapshot.dirty,
|
|
260
|
+
entrypointRelativePath: snapshot.relativeEntrypoint,
|
|
261
|
+
sourceSurface: 'connect_assisted',
|
|
262
|
+
detectedTooling: snapshot.detectedTooling,
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
return {
|
|
266
|
+
name,
|
|
267
|
+
description,
|
|
268
|
+
sourceUrl,
|
|
269
|
+
runtimeIdentity: {
|
|
270
|
+
contractVersion: RUNTIME_IDENTITY_VERSION,
|
|
271
|
+
subjectType: snapshot.subjectType,
|
|
272
|
+
subjectLabel,
|
|
273
|
+
repoRootFingerprint: snapshot.repoRootFingerprint,
|
|
274
|
+
...(snapshot.repoRemoteFingerprint ? { repoRemoteFingerprint: snapshot.repoRemoteFingerprint } : {}),
|
|
275
|
+
worktreeId: snapshot.worktreeId,
|
|
276
|
+
entrypointRelativePath: snapshot.relativeEntrypoint,
|
|
277
|
+
deploymentEnvironment,
|
|
278
|
+
},
|
|
279
|
+
metadata,
|
|
280
|
+
snapshot,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function inspectRuntimeProject(options = {}) {
|
|
284
|
+
const cwd = realpathSafe(options.cwd ?? process.cwd());
|
|
285
|
+
const repoRoot = realpathSafe(runGit(cwd, ['rev-parse', '--show-toplevel']) ?? cwd);
|
|
286
|
+
const repoRootName = node_path_1.default.basename(repoRoot) || 'runtime';
|
|
287
|
+
const branch = runGit(repoRoot, ['rev-parse', '--abbrev-ref', 'HEAD']);
|
|
288
|
+
const commit = runGit(repoRoot, ['rev-parse', 'HEAD']);
|
|
289
|
+
const dirty = Boolean(trimOptional(runGit(repoRoot, ['status', '--porcelain'])));
|
|
290
|
+
const rawRemote = runGit(repoRoot, ['config', '--get', 'remote.origin.url']);
|
|
291
|
+
const sourceUrl = normalizeSourceUrl(options.sourceUrl) ?? normalizeSourceUrl(rawRemote);
|
|
292
|
+
const subjectType = chooseSubjectType(options.subjectType, repoRoot !== cwd || Boolean(branch) || Boolean(commit));
|
|
293
|
+
const relativeEntrypoint = normalizeRelativePath(options.entrypointRelativePath, repoRoot, cwd);
|
|
294
|
+
const repoRootFingerprint = hashHex(`repo-root:${repoRoot}`);
|
|
295
|
+
const repoRemoteFingerprint = rawRemote ? hashHex(`repo-remote:${rawRemote}`) : null;
|
|
296
|
+
const worktreeSeed = `${repoRoot}|${branch || 'detached'}|${relativeEntrypoint}`;
|
|
297
|
+
const worktreeId = slugifyRuntimeLabel(`${repoRootName}-${hashHex(worktreeSeed).slice(0, 12)}`, 120);
|
|
298
|
+
const detectedTooling = detectTooling(repoRoot, cwd);
|
|
299
|
+
return buildRuntimeRegistrationDraft({
|
|
300
|
+
cwd,
|
|
301
|
+
repoRoot,
|
|
302
|
+
repoRootName,
|
|
303
|
+
sourceUrl,
|
|
304
|
+
subjectType,
|
|
305
|
+
branch,
|
|
306
|
+
commit,
|
|
307
|
+
dirty,
|
|
308
|
+
relativeEntrypoint,
|
|
309
|
+
repoRootFingerprint,
|
|
310
|
+
repoRemoteFingerprint,
|
|
311
|
+
worktreeId,
|
|
312
|
+
detectedTooling,
|
|
313
|
+
}, options);
|
|
314
|
+
}
|
|
315
|
+
exports.__private__ = {
|
|
316
|
+
normalizeSourceUrl,
|
|
317
|
+
sanitizeRuntimeName,
|
|
318
|
+
};
|
|
319
|
+
//# sourceMappingURL=runtime-registration.js.map
|
package/dist/v1/service.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { type AgentProcessMetadata, type ProcessListEntry } from './process-scou
|
|
|
5
5
|
import { LocalStateStore } from './state';
|
|
6
6
|
import { type VitalityPulseDependencies } from './vitality-pulse';
|
|
7
7
|
import { type MonitorPassResult } from './lifecycle-monitor';
|
|
8
|
-
import type { AgentLink, AgentModelUsageLedgerSummary, AgentReviewSnapshot, AgentType, BuildDatasetRef, BuildSession, BuildSessionStatus, C2SessionControlSource, C2SessionMode, C2SessionState, C2SessionSummary, C2LifecycleEvent, C2LiteEventType, ConnectBindingState, ConnectHandoffPayload, ConnectIdentityState, ConnectPermissionsSummary, ConnectServicesSummary, ConnectState, ConnectConfig, ConnectEffectiveBindingState, ServiceEntitlements, DaemonScanSummary, DaemonStatus, DetectedAgent, DetectedModel, DeliveredNotification, EvolutionReviewSnapshot, ModelEvolutionCandidate, DiscoveryClassification, DiscoveryMode, ModelBinding, ProviderHealthStatus, NotificationCandidate, NotificationSuggestedAction, RuntimePassportStatus, RuntimeType, SmartRegistrationInbox, SmartRegistrationInboxAction, PulseStatus, ReviewSnapshot, SanitizedProcessMetadata, ShadowFinding, TrayMenuModel, TrayStatusColor, TrainingLifecycleEventType, VitalityPulseEvent, VitalityPulseSummary, PendingReview } from './types';
|
|
8
|
+
import type { AgentLink, AgentModelUsageLedgerSummary, AgentReviewSnapshot, AgentType, BuildDatasetRef, BuildSession, BuildSessionStatus, C2SessionControlSource, C2SessionMode, C2SessionState, C2SessionSummary, C2LifecycleEvent, C2LiteEventType, ConnectBindingState, ConnectHandoffPayload, ConnectIdentityState, ConnectPermissionsSummary, ConnectServicesSummary, ConnectState, ConnectConfig, ConnectEffectiveBindingState, ServiceEntitlements, DaemonScanSummary, DaemonStatus, DetectedAgent, DetectedModel, DeliveredNotification, EvolutionReviewSnapshot, ModelEvolutionCandidate, DiscoveryClassification, DiscoveryMode, ModelBinding, ProviderHealthStatus, NotificationCandidate, NotificationSuggestedAction, RuntimeObserverTarget, RuntimePassportStatus, RuntimeType, SmartRegistrationInbox, SmartRegistrationInboxAction, PulseStatus, ReviewSnapshot, SanitizedProcessMetadata, ShadowFinding, TrayMenuModel, TrayStatusColor, TrainingLifecycleEventType, VitalityPulseEvent, VitalityPulseSummary, PendingReview } from './types';
|
|
9
9
|
export type NotificationSender = (title: string, message: string, candidate?: NotificationCandidate) => boolean;
|
|
10
10
|
export interface StatusResult {
|
|
11
11
|
runtimeId: string;
|
|
@@ -326,6 +326,7 @@ export declare class ConnectV1Service {
|
|
|
326
326
|
private buildServiceEntitlements;
|
|
327
327
|
private syncServiceEntitlements;
|
|
328
328
|
private syncIdentityFromLocalState;
|
|
329
|
+
private syncRuntimeIdentityMetadata;
|
|
329
330
|
private createConnectIdentity;
|
|
330
331
|
initializeConnectIdentity(): ConnectInitResult;
|
|
331
332
|
setSessionRef(sessionRef: string | null): void;
|
|
@@ -342,6 +343,7 @@ export declare class ConnectV1Service {
|
|
|
342
343
|
getConfig(): ConnectConfig;
|
|
343
344
|
getServiceEntitlements(): ServiceEntitlements;
|
|
344
345
|
private getApiClient;
|
|
346
|
+
private getApiClientWithSessionToken;
|
|
345
347
|
private ensureRuntimePassportIdentity;
|
|
346
348
|
private findRuntimePassportByGaid;
|
|
347
349
|
private findRuntimePassportForRuntime;
|
|
@@ -452,6 +454,25 @@ export declare class ConnectV1Service {
|
|
|
452
454
|
gaid: string;
|
|
453
455
|
keyRef: string | null;
|
|
454
456
|
};
|
|
457
|
+
registerRuntimeObserverTarget(input: {
|
|
458
|
+
gaid: string;
|
|
459
|
+
repoRoot: string;
|
|
460
|
+
clientName?: string | null;
|
|
461
|
+
subjectId?: string | null;
|
|
462
|
+
worktreeId?: string | null;
|
|
463
|
+
}): RuntimeObserverTarget;
|
|
464
|
+
listRuntimeObserverTargets(): RuntimeObserverTarget[];
|
|
465
|
+
hasRuntimeSignalKey(gaid: string): boolean;
|
|
466
|
+
hasStoredRuntimeSignalKey(gaid: string | null): boolean;
|
|
467
|
+
removeRuntimeObserverTarget(gaid: string): boolean;
|
|
468
|
+
updateRuntimeObserverTargetResult(input: {
|
|
469
|
+
gaid: string;
|
|
470
|
+
observedAt?: string | null;
|
|
471
|
+
emittedAt?: string | null;
|
|
472
|
+
fingerprint?: string | null;
|
|
473
|
+
summary?: string | null;
|
|
474
|
+
error?: string | null;
|
|
475
|
+
}): RuntimeObserverTarget | null;
|
|
455
476
|
/**
|
|
456
477
|
* After login, automatically create a runtime-signal API key for every bound
|
|
457
478
|
* passport that doesn't already have one stored locally.
|
|
@@ -528,6 +549,28 @@ export declare class ConnectV1Service {
|
|
|
528
549
|
estimatedCostCents?: number | undefined;
|
|
529
550
|
currency?: string | null;
|
|
530
551
|
summary?: string | null;
|
|
552
|
+
metadata?: Record<string, unknown> | null;
|
|
553
|
+
steps?: Array<Record<string, unknown>> | null;
|
|
554
|
+
}): Promise<ApiCallResult>;
|
|
555
|
+
emitRuntimeObserverCheckin(input: {
|
|
556
|
+
gaid: string;
|
|
557
|
+
apiKey?: string | null;
|
|
558
|
+
sessionId?: string | null;
|
|
559
|
+
sessionLabel?: string | null;
|
|
560
|
+
environment?: string | null;
|
|
561
|
+
region?: string | null;
|
|
562
|
+
hostLabel?: string | null;
|
|
563
|
+
runtimeLabel?: string | null;
|
|
564
|
+
runtimeMode?: 'active' | 'paused' | 'standby' | 'sleeping' | 'offline' | 'revoked' | string | null;
|
|
565
|
+
resourceAccuracy?: 'reported' | 'estimated' | 'unknown' | string | null;
|
|
566
|
+
resourceNote?: string | null;
|
|
567
|
+
cpuPercent?: number | undefined;
|
|
568
|
+
memoryMb?: number | undefined;
|
|
569
|
+
vramMb?: number | undefined;
|
|
570
|
+
promptTokens?: number | undefined;
|
|
571
|
+
completionTokens?: number | undefined;
|
|
572
|
+
executionMs?: number | undefined;
|
|
573
|
+
metadata?: Record<string, unknown> | null;
|
|
531
574
|
}): Promise<ApiCallResult>;
|
|
532
575
|
private findAgentByIdOrName;
|
|
533
576
|
private findAgentLink;
|