@nurix/nustack 0.10.0-dev.13 → 0.10.0-dev.14
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/commands/bootstrap.js +4 -4
- package/dist/commands/docs.js +13 -13
- package/dist/commands/doctor.js +13 -13
- package/dist/commands/handoff.js +8 -8
- package/dist/commands/init.js +43 -43
- package/dist/commands/{workspace-sync.js → project-sync.js} +5 -5
- package/dist/commands/{workspace.js → project.js} +133 -133
- package/dist/commands/review.js +5 -5
- package/dist/commands/search.js +7 -7
- package/dist/commands/sessions.js +1 -1
- package/dist/commands/sync.js +10 -10
- package/dist/commands/toolkit.js +19 -19
- package/dist/index.js +29 -29
- package/dist/lib/etna/profile.js +9 -9
- package/dist/lib/etna/reconcile.js +11 -11
- package/dist/lib/git-sync/core/engine.js +4 -4
- package/dist/lib/git-sync/inbound/apply_commit.js +3 -3
- package/dist/lib/git-sync/inbound/approval.js +1 -1
- package/dist/lib/git-sync/inbound/download.js +8 -8
- package/dist/lib/git-sync/inbound/event_sync.js +13 -13
- package/dist/lib/git-sync/inbound/notification.js +1 -1
- package/dist/lib/git-sync/outbound/extraction.js +4 -4
- package/dist/lib/git-sync/outbound/history_decision.js +2 -2
- package/dist/lib/git-sync/outbound/publisher.js +2 -2
- package/dist/lib/git-sync/outbound/queue.js +3 -3
- package/dist/lib/git-sync/outbound/upload_client.js +4 -4
- package/dist/lib/git-sync/whitelist/index.js +1 -1
- package/dist/lib/git-sync/whitelist/types.js +1 -1
- package/dist/lib/git-sync/whitelist/validation.js +5 -5
- package/dist/lib/lanes/supervisor.js +8 -8
- package/dist/lib/local_store/accepted_uploads.js +5 -5
- package/dist/lib/local_store/bindings.js +11 -11
- package/dist/lib/local_store/index.js +1 -1
- package/dist/lib/local_store/migrations.js +13 -0
- package/dist/lib/local_store/project_events_cache.js +54 -0
- package/dist/lib/nustack_client.js +45 -45
- package/dist/lib/onboarding/attach_existing_git.js +7 -7
- package/dist/lib/onboarding/binding.js +11 -11
- package/dist/lib/onboarding/folder_state.js +10 -10
- package/dist/lib/onboarding/handoff_apply.js +2 -2
- package/dist/lib/onboarding/init_fresh_folder.js +18 -18
- package/dist/lib/onboarding/manifest_writer.js +31 -31
- package/dist/lib/onboarding/web_first_attach.js +12 -12
- package/dist/lib/{workspace_context.js → project_context.js} +24 -24
- package/dist/lib/review/client.js +1 -1
- package/dist/lib/session_telemetry.js +2 -2
- package/dist/lib/sessions/client.js +8 -8
- package/dist/lib/sessions/outsideSessions.js +3 -3
- package/dist/lib/telemetry/config_renderer.js +3 -3
- package/dist/lib/telemetry/health_report.js +1 -1
- package/package.json +3 -3
- package/dist/lib/local_store/workspace_events_cache.js +0 -54
|
@@ -23,19 +23,19 @@ export function makeSessionsClient(baseUrl, accessToken) {
|
|
|
23
23
|
return { status: response.status, session: payload.data };
|
|
24
24
|
}
|
|
25
25
|
return {
|
|
26
|
-
async createSession(
|
|
27
|
-
const safeId = assertSafeOpaqueId("The
|
|
28
|
-
const answered = await post(`/api/v2/
|
|
26
|
+
async createSession(projectId, input) {
|
|
27
|
+
const safeId = assertSafeOpaqueId("The Project id", projectId);
|
|
28
|
+
const answered = await post(`/api/v2/projects/${encodeURIComponent(safeId)}/sessions`, input, "session create failed");
|
|
29
29
|
return { created: answered.status === 201, session: answered.session };
|
|
30
30
|
},
|
|
31
|
-
async transitionSession(
|
|
32
|
-
const
|
|
31
|
+
async transitionSession(projectId, sessionId, to, patch = {}) {
|
|
32
|
+
const safeProject = assertSafeOpaqueId("The Project id", projectId);
|
|
33
33
|
const safeSession = assertSafeOpaqueId("The session id", sessionId);
|
|
34
|
-
const answered = await post(`/api/v2/
|
|
34
|
+
const answered = await post(`/api/v2/projects/${encodeURIComponent(safeProject)}/sessions/${encodeURIComponent(safeSession)}/transition`, { to, ...patch }, "session transition failed");
|
|
35
35
|
return answered.session;
|
|
36
36
|
},
|
|
37
|
-
async setVendorSessionId(
|
|
38
|
-
return this.transitionSession(
|
|
37
|
+
async setVendorSessionId(projectId, sessionId, vendorSessionId) {
|
|
38
|
+
return this.transitionSession(projectId, sessionId, "running", { vendorSessionId });
|
|
39
39
|
},
|
|
40
40
|
};
|
|
41
41
|
}
|
|
@@ -12,7 +12,7 @@ export async function recordOutsideSessions(client, input) {
|
|
|
12
12
|
const laneIds = new Set((input.laneSessionIds ?? []).filter((id) => Boolean(id)));
|
|
13
13
|
const report = { created: 0, finished: 0, skipped: 0, failed: 0 };
|
|
14
14
|
for (const transcript of input.transcripts) {
|
|
15
|
-
if (!transcript.
|
|
15
|
+
if (!transcript.projectId) {
|
|
16
16
|
report.skipped += 1;
|
|
17
17
|
continue;
|
|
18
18
|
}
|
|
@@ -25,7 +25,7 @@ export async function recordOutsideSessions(client, input) {
|
|
|
25
25
|
const vendorSessionId = transcript.vendorSessionId?.trim() || null;
|
|
26
26
|
const isLane = vendorSessionId !== null && laneIds.has(vendorSessionId);
|
|
27
27
|
try {
|
|
28
|
-
const { created, session } = await client.createSession(transcript.
|
|
28
|
+
const { created, session } = await client.createSession(transcript.projectId, {
|
|
29
29
|
id: transcript.sessionKey,
|
|
30
30
|
startedBy: "person",
|
|
31
31
|
substrate: "device",
|
|
@@ -39,7 +39,7 @@ export async function recordOutsideSessions(client, input) {
|
|
|
39
39
|
if (created)
|
|
40
40
|
report.created += 1;
|
|
41
41
|
if (stale && !AT_REST.has(session.status)) {
|
|
42
|
-
await client.transitionSession(transcript.
|
|
42
|
+
await client.transitionSession(transcript.projectId, transcript.sessionKey, "done");
|
|
43
43
|
report.finished += 1;
|
|
44
44
|
}
|
|
45
45
|
else if (!created) {
|
|
@@ -92,7 +92,7 @@ const BINDING_TEMPLATE = `# Managed by the nustack CLI — binding: {{binding_id
|
|
|
92
92
|
nustack:
|
|
93
93
|
schema_version: {{schema_version}}
|
|
94
94
|
organization_id: {{organization_id}}
|
|
95
|
-
|
|
95
|
+
project_id: {{project_id}}
|
|
96
96
|
binding_id: {{binding_id}}
|
|
97
97
|
device_id: {{device_id}}
|
|
98
98
|
user_id: {{user_id}}
|
|
@@ -116,7 +116,7 @@ export function renderBindingInput(binding) {
|
|
|
116
116
|
claude_glob: yamlScalar(`${claudeProjectDir(binding.repoRoot)}/**/*.jsonl`),
|
|
117
117
|
schema_version: String(ENVELOPE_SCHEMA_VERSION),
|
|
118
118
|
organization_id: yamlScalar(binding.organizationId),
|
|
119
|
-
|
|
119
|
+
project_id: yamlScalar(binding.projectId),
|
|
120
120
|
binding_id: yamlScalar(binding.bindingId),
|
|
121
121
|
device_id: yamlScalar(binding.deviceRef),
|
|
122
122
|
user_id: yamlScalar(binding.userId),
|
|
@@ -142,7 +142,7 @@ export function renderCodexSharedInput(bindings) {
|
|
|
142
142
|
target: nustack
|
|
143
143
|
fields:
|
|
144
144
|
organization_id: ${yamlScalar(binding.organizationId)}
|
|
145
|
-
|
|
145
|
+
project_id: ${yamlScalar(binding.projectId)}
|
|
146
146
|
binding_id: ${yamlScalar(binding.bindingId)}`)
|
|
147
147
|
.join("\n");
|
|
148
148
|
const dropList = ["cwd", ...providerDropFields("codex")].join(", ");
|
|
@@ -38,7 +38,7 @@ export async function collectTelemetryStatus(store, probes = defaultProbes(), op
|
|
|
38
38
|
bindingId: binding.id,
|
|
39
39
|
repoRoot: binding.repositoryRoot,
|
|
40
40
|
organizationId: binding.organizationId,
|
|
41
|
-
|
|
41
|
+
projectId: binding.projectId,
|
|
42
42
|
deviceRef,
|
|
43
43
|
userId,
|
|
44
44
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nurix/nustack",
|
|
3
|
-
"version": "0.10.0-dev.
|
|
3
|
+
"version": "0.10.0-dev.14",
|
|
4
4
|
"description": "The nustack CLI — bootstrap NuStack services into a repo via the NuStack discovery plane.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@types/node": "^22.19.20",
|
|
34
34
|
"typescript": "^5.7.2",
|
|
35
35
|
"vitest": "^4.1.11",
|
|
36
|
-
"@nurix/nustack.
|
|
37
|
-
"@nurix/nustack.
|
|
36
|
+
"@nurix/nustack.ui": "0.0.0",
|
|
37
|
+
"@nurix/nustack.studio": "0.0.0"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export const DEFAULT_WORKSPACE_EVENT_KEEP_COUNT = 500;
|
|
2
|
-
function mapRow(row) {
|
|
3
|
-
return {
|
|
4
|
-
bindingId: row.binding_id,
|
|
5
|
-
workspaceSequence: row.workspace_sequence,
|
|
6
|
-
eventType: row.event_type,
|
|
7
|
-
payloadJson: row.payload_json ?? null,
|
|
8
|
-
appliedAtMs: row.applied_at_ms ?? null,
|
|
9
|
-
createdAtMs: row.created_at_ms,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export function cacheWorkspaceEvents(store, bindingId, events) {
|
|
13
|
-
const now = Date.now();
|
|
14
|
-
const insert = store.db.prepare(`INSERT INTO cached_workspace_events (
|
|
15
|
-
binding_id, workspace_sequence, event_type, payload_json, applied_at_ms, created_at_ms
|
|
16
|
-
) VALUES (
|
|
17
|
-
:binding_id, :workspace_sequence, :event_type, :payload_json, :applied_at_ms, :created_at_ms
|
|
18
|
-
)
|
|
19
|
-
ON CONFLICT(binding_id, workspace_sequence) DO NOTHING`);
|
|
20
|
-
for (const event of events) {
|
|
21
|
-
insert.run({
|
|
22
|
-
binding_id: bindingId,
|
|
23
|
-
workspace_sequence: event.workspaceSequence,
|
|
24
|
-
event_type: event.eventType,
|
|
25
|
-
payload_json: event.payloadJson ?? null,
|
|
26
|
-
applied_at_ms: event.appliedAtMs ?? null,
|
|
27
|
-
created_at_ms: now,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export function latestCachedSequence(store, bindingId) {
|
|
32
|
-
const row = store.db
|
|
33
|
-
.prepare("SELECT MAX(workspace_sequence) AS latest FROM cached_workspace_events WHERE binding_id = :binding_id")
|
|
34
|
-
.get({ binding_id: bindingId });
|
|
35
|
-
return row?.latest ?? null;
|
|
36
|
-
}
|
|
37
|
-
export function listCachedWorkspaceEvents(store, bindingId) {
|
|
38
|
-
const rows = store.db
|
|
39
|
-
.prepare("SELECT * FROM cached_workspace_events WHERE binding_id = :binding_id ORDER BY workspace_sequence ASC")
|
|
40
|
-
.all({ binding_id: bindingId });
|
|
41
|
-
return rows.map(mapRow);
|
|
42
|
-
}
|
|
43
|
-
export function pruneWorkspaceEvents(store, bindingId, keepCount = DEFAULT_WORKSPACE_EVENT_KEEP_COUNT) {
|
|
44
|
-
store.db
|
|
45
|
-
.prepare(`DELETE FROM cached_workspace_events
|
|
46
|
-
WHERE binding_id = :binding_id
|
|
47
|
-
AND workspace_sequence NOT IN (
|
|
48
|
-
SELECT workspace_sequence FROM cached_workspace_events
|
|
49
|
-
WHERE binding_id = :binding_id
|
|
50
|
-
ORDER BY workspace_sequence DESC
|
|
51
|
-
LIMIT :keep
|
|
52
|
-
)`)
|
|
53
|
-
.run({ binding_id: bindingId, keep: keepCount });
|
|
54
|
-
}
|