@midhunxavier/code-flow 0.0.0-stage → 0.1.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +122 -2
- package/bin/codeflow.mjs +8 -0
- package/bin/launcher.mjs +127 -0
- package/dist/remote-host.json +1 -0
- package/licenses/inter.txt +92 -0
- package/licenses/preact.txt +21 -0
- package/licenses/signals-core.txt +21 -0
- package/licenses/signals.txt +21 -0
- package/licenses/typescript-notices.txt +193 -0
- package/licenses/typescript.txt +55 -0
- package/licenses/uqr.txt +22 -0
- package/licenses/xterm-fit.txt +19 -0
- package/licenses/xterm.txt +21 -0
- package/package.json +34 -4
- package/public/assets/browser-7XI52A6V.js +8 -0
- package/public/assets/changes-EYFPASEI.js +1 -0
- package/public/assets/chunk-7H3ZLTKA.js +2 -0
- package/public/assets/chunk-L7TUCIYF.js +1 -0
- package/public/assets/chunk-LLMQG23J.js +163 -0
- package/public/assets/main-KIRM2OEK.js +1 -0
- package/public/assets/settings-QJZVW22Y.js +9 -0
- package/public/assets/styles-615EBB20.css +32 -0
- package/public/assets/terminal-A2FI2NAX.js +62 -0
- package/public/assets.json +1 -0
- package/public/bundle-meta.json +1 -0
- package/public/docs/.nojekyll +0 -0
- package/public/docs/accessibility.html +19 -0
- package/public/docs/acp-agents.html +117 -0
- package/public/docs/agent-containers.html +79 -0
- package/public/docs/api.html +1130 -0
- package/public/docs/app.js +342 -0
- package/public/docs/application-improvements.html +275 -0
- package/public/docs/architecture-explorer.html +19 -0
- package/public/docs/architecture.html +149 -0
- package/public/docs/auto-team.html +142 -0
- package/public/docs/automations.html +109 -0
- package/public/docs/checkpoint-review.html +37 -0
- package/public/docs/code-hosts.html +35 -0
- package/public/docs/code-intelligence.html +35 -0
- package/public/docs/configuration.html +346 -0
- package/public/docs/context-inspection.html +23 -0
- package/public/docs/coordinated-changes.html +28 -0
- package/public/docs/deferred-runs.html +25 -0
- package/public/docs/dependency-discovery.html +19 -0
- package/public/docs/documentation.html +84 -0
- package/public/docs/dynamic-teams-evaluation.html +174 -0
- package/public/docs/dynamic-teams-implementation-plan.html +882 -0
- package/public/docs/dynamic-teams-implementation-review-1.html +141 -0
- package/public/docs/dynamic-teams-plan-review-0.html +204 -0
- package/public/docs/extensions.html +42 -0
- package/public/docs/external-sources.html +96 -0
- package/public/docs/filesystem-policy.html +26 -0
- package/public/docs/filtered-tasks.html +44 -0
- package/public/docs/font-license.txt +92 -0
- package/public/docs/getting-started.html +118 -0
- package/public/docs/github-review-threads.html +26 -0
- package/public/docs/github.html +157 -0
- package/public/docs/help.html +69 -0
- package/public/docs/index.html +77 -0
- package/public/docs/installation.html +74 -0
- package/public/docs/launch-profiles.html +48 -0
- package/public/docs/maintenance.html +60 -0
- package/public/docs/memory-claims.html +31 -0
- package/public/docs/memory-storage.html +58 -0
- package/public/docs/notifications.html +39 -0
- package/public/docs/patterns.html +195 -0
- package/public/docs/performance-results.html +210 -0
- package/public/docs/performance.html +166 -0
- package/public/docs/project-conventions.html +22 -0
- package/public/docs/project-first-navigation-plan.html +587 -0
- package/public/docs/project-teams-implementation-plan.html +772 -0
- package/public/docs/project-teams.html +99 -0
- package/public/docs/provider-compatibility.html +20 -0
- package/public/docs/releasing.html +61 -0
- package/public/docs/remote-workers.html +64 -0
- package/public/docs/review-inbox.html +26 -0
- package/public/docs/run-storage.html +23 -0
- package/public/docs/runs.html +141 -0
- package/public/docs/search.json +1 -0
- package/public/docs/security.html +133 -0
- package/public/docs/shared-projects.html +31 -0
- package/public/docs/ssh-projects.html +60 -0
- package/public/docs/style.css +768 -0
- package/public/docs/task-reruns.html +30 -0
- package/public/docs/team-collaboration.html +379 -0
- package/public/docs/verification.html +22 -0
- package/public/docs/vscode.html +53 -0
- package/public/docs/worker-permission-verification.html +122 -0
- package/public/index.html +17 -0
- package/scripts/check-node.mjs +7 -0
- package/scripts/codeflow.mjs +55 -0
- package/scripts/pty.py +273 -0
- package/src/acp-connections.js +110 -0
- package/src/adapters/acp-presets.js +37 -0
- package/src/adapters/acp-types.js +0 -0
- package/src/adapters/acp.js +328 -0
- package/src/adapters/agy-auth.js +67 -0
- package/src/adapters/agy-isolation.js +223 -0
- package/src/adapters/agy.js +297 -0
- package/src/adapters/claude.js +220 -0
- package/src/adapters/codex-app-server.js +518 -0
- package/src/adapters/codex.js +299 -0
- package/src/adapters/errors.js +57 -0
- package/src/adapters/index.js +91 -0
- package/src/adapters/managed-permissions.js +37 -0
- package/src/adapters/model-discovery.js +100 -0
- package/src/adapters/process.js +418 -0
- package/src/adapters/team-tools.js +102 -0
- package/src/adapters/types.js +0 -0
- package/src/agent-container.js +155 -0
- package/src/approvals.js +121 -0
- package/src/architecture.js +456 -0
- package/src/assets.js +44 -0
- package/src/automation.js +901 -0
- package/src/certificate-renewal.js +75 -0
- package/src/chat-handoff.js +55 -0
- package/src/checkpoint-review.js +72 -0
- package/src/checks.js +303 -0
- package/src/code-host-git.js +102 -0
- package/src/code-hosts-api.js +99 -0
- package/src/code-hosts.js +482 -0
- package/src/code-intelligence-worker.mjs +452 -0
- package/src/code-intelligence.js +141 -0
- package/src/collab/api.js +365 -0
- package/src/collab/checkpoints.js +198 -0
- package/src/collab/connections.js +139 -0
- package/src/collab/host-execution.js +347 -0
- package/src/collab/hub-client.js +210 -0
- package/src/collab/link-api.js +229 -0
- package/src/collab/link.js +595 -0
- package/src/collab/model.js +496 -0
- package/src/collab/runner.js +1014 -0
- package/src/collab/store.js +1452 -0
- package/src/collab/terminals.js +361 -0
- package/src/collaboration-reviews.js +116 -0
- package/src/config.js +48 -0
- package/src/context-budget.js +14 -0
- package/src/context-inspection.js +204 -0
- package/src/context.js +154 -0
- package/src/conventions.js +283 -0
- package/src/coordinated-api.js +247 -0
- package/src/deferred-launch.js +82 -0
- package/src/deferred-runs.js +515 -0
- package/src/dependency-health.js +35 -0
- package/src/diff.js +43 -0
- package/src/docs-help.js +316 -0
- package/src/doctor.js +232 -0
- package/src/engine.js +4366 -0
- package/src/env.js +44 -0
- package/src/experience.js +50 -0
- package/src/extensions.js +144 -0
- package/src/filesystem-access.js +107 -0
- package/src/filesystem-policy.js +238 -0
- package/src/filtered-task-limits.js +93 -0
- package/src/filtered-tasks-api.js +53 -0
- package/src/filtered-tasks.js +576 -0
- package/src/fs.js +57 -0
- package/src/git.js +626 -0
- package/src/github-review-threads.js +181 -0
- package/src/github.js +538 -0
- package/src/http.js +69 -0
- package/src/improve-settings.js +38 -0
- package/src/improve.js +187 -0
- package/src/integrations.js +373 -0
- package/src/integrity.js +259 -0
- package/src/journey-api.js +77 -0
- package/src/journey-replay.js +65 -0
- package/src/journey-store.js +97 -0
- package/src/journeys.js +60 -0
- package/src/json.js +81 -0
- package/src/launch-profiles.js +292 -0
- package/src/learnings.js +80 -0
- package/src/log.js +39 -0
- package/src/maintenance.js +335 -0
- package/src/memory-analysis.js +182 -0
- package/src/memory-claims.js +153 -0
- package/src/memory-sqlite.js +236 -0
- package/src/memory.js +552 -0
- package/src/merge-validation.js +58 -0
- package/src/model-catalog.js +238 -0
- package/src/model-research.js +91 -0
- package/src/notes.js +176 -0
- package/src/notifications.js +413 -0
- package/src/patterns/auto-team-model.js +212 -0
- package/src/patterns/auto-team.js +659 -0
- package/src/patterns/council.js +199 -0
- package/src/patterns/debate.js +188 -0
- package/src/patterns/findings.js +141 -0
- package/src/patterns/index.js +19 -0
- package/src/patterns/loop.js +158 -0
- package/src/patterns/pipeline.js +125 -0
- package/src/patterns/prompts.js +181 -0
- package/src/patterns/race.js +147 -0
- package/src/patterns/schemas.js +40 -0
- package/src/patterns/solo.js +49 -0
- package/src/patterns/supervisor.js +235 -0
- package/src/patterns/task-draft.js +29 -0
- package/src/patterns/tdd.js +231 -0
- package/src/patterns/team-strategies.js +67 -0
- package/src/performance.js +43 -0
- package/src/persistence-status.js +35 -0
- package/src/phone-sessions.js +96 -0
- package/src/preview-overlay.js +383 -0
- package/src/preview.js +219 -0
- package/src/privacy.js +23 -0
- package/src/project-report.js +22 -0
- package/src/project-team-model.js +178 -0
- package/src/project-team-policy.js +42 -0
- package/src/project-team-store.js +213 -0
- package/src/project-teams-api.js +36 -0
- package/src/project-teams.js +551 -0
- package/src/projects.js +286 -0
- package/src/provider-eligibility.js +9 -0
- package/src/readiness.js +98 -0
- package/src/remote-tls.js +66 -0
- package/src/remote-workers/bundles.js +198 -0
- package/src/remote-workers/client.js +332 -0
- package/src/remote-workers/durability.js +37 -0
- package/src/remote-workers/protocol.js +68 -0
- package/src/remote-workers/stdio.js +138 -0
- package/src/remote-workers/worker.js +304 -0
- package/src/remote.js +204 -0
- package/src/repo-config.js +201 -0
- package/src/repo-coordination.js +732 -0
- package/src/repo-tree.js +106 -0
- package/src/retention-policy.js +466 -0
- package/src/review-inbox.js +38 -0
- package/src/routing.js +49 -0
- package/src/run-analysis.js +111 -0
- package/src/run-cold-store.js +231 -0
- package/src/run-environment.js +15 -0
- package/src/run-history.js +91 -0
- package/src/run-log.js +160 -0
- package/src/run-permissions.js +110 -0
- package/src/run-projection.js +75 -0
- package/src/run-recovery.js +53 -0
- package/src/run-status.js +54 -0
- package/src/serve.js +138 -0
- package/src/server.js +2738 -0
- package/src/shared-access.js +103 -0
- package/src/shared-accounts.js +301 -0
- package/src/shared-api.js +239 -0
- package/src/shell.js +346 -0
- package/src/ship.js +344 -0
- package/src/slots.js +74 -0
- package/src/snapshot.js +388 -0
- package/src/source-context.js +17 -0
- package/src/sse-writer.js +70 -0
- package/src/ssh-projects/bootstrap.mjs +95 -0
- package/src/ssh-projects/config.js +45 -0
- package/src/ssh-projects/gateway.js +143 -0
- package/src/ssh-projects/manager.js +320 -0
- package/src/ssh-projects/team-autostart.mjs +93 -0
- package/src/ssh-projects/team-remove.mjs +69 -0
- package/src/ssh-projects/team-status.mjs +39 -0
- package/src/ssh-projects/transport.js +116 -0
- package/src/stats.js +139 -0
- package/src/store.js +544 -0
- package/src/stream.js +91 -0
- package/src/sweeps.js +241 -0
- package/src/tailscale.js +101 -0
- package/src/task-draft.js +23 -0
- package/src/team-evaluation.js +242 -0
- package/src/team-mailbox.js +160 -0
- package/src/team-memory.js +84 -0
- package/src/team-rerun-graph.js +15 -0
- package/src/team-reruns.js +130 -0
- package/src/team-scheduler.js +121 -0
- package/src/team-template-store.js +98 -0
- package/src/team-templates.js +117 -0
- package/src/team-tool-client.mjs +79 -0
- package/src/team-tools.js +176 -0
- package/src/teams.js +0 -0
- package/src/templates.js +62 -0
- package/src/transcript.js +134 -0
- package/src/verification-integrity.js +27 -0
- package/src/verification.js +183 -0
- package/src/watch.js +195 -0
- package/src/work-queue.js +47 -0
- package/src/workflow-control.js +83 -0
- package/src/workspace-api.js +207 -0
- package/src/workspace-changes.js +61 -0
- package/src/workspace.js +146 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { lstat, opendir } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
const FILTERED_WORKSPACE_LIMITS = { entries: 2e3, depth: 32, logicalBytes: 32 * 1024 * 1024, allocatedBytes: 64 * 1024 * 1024, scanMs: 5e3 };
|
|
4
|
+
class FilteredWorkspaceLimitError extends Error {
|
|
5
|
+
}
|
|
6
|
+
async function inspectFilteredWorkspace(root, stopped = () => false) {
|
|
7
|
+
const stats = { entries: 0, logicalBytes: 0, allocatedBytes: 0 }, started = Date.now();
|
|
8
|
+
const fail = (reason) => {
|
|
9
|
+
throw new FilteredWorkspaceLimitError(`Filtered workspace ${reason}; stop the task and inspect its bounded output`);
|
|
10
|
+
};
|
|
11
|
+
const walk = async (directory, depth) => {
|
|
12
|
+
if (stopped()) return;
|
|
13
|
+
if (depth > FILTERED_WORKSPACE_LIMITS.depth) fail("directory depth exceeds its live limit");
|
|
14
|
+
const before = await lstat(directory);
|
|
15
|
+
if (!before.isDirectory() || before.isSymbolicLink()) fail("contains a symbolic or non-directory ancestor");
|
|
16
|
+
const handle = await opendir(directory, { bufferSize: 32 });
|
|
17
|
+
try {
|
|
18
|
+
const current = await lstat(directory);
|
|
19
|
+
if (current.isSymbolicLink() || current.dev !== before.dev || current.ino !== before.ino) fail("directory changed during inspection");
|
|
20
|
+
for await (const entry of handle) {
|
|
21
|
+
if (stopped()) return;
|
|
22
|
+
if (depth === 0 && entry.name === ".git") continue;
|
|
23
|
+
if (++stats.entries > FILTERED_WORKSPACE_LIMITS.entries) fail("entry count exceeds its live limit");
|
|
24
|
+
if (Date.now() - started > FILTERED_WORKSPACE_LIMITS.scanMs) fail("inspection exceeded its deadline");
|
|
25
|
+
if (!entry.name || entry.name === "." || entry.name === ".." || /[\\/\x00-\x1f\x7f]/.test(entry.name)) fail("contains an unsupported entry name");
|
|
26
|
+
const path = join(directory, entry.name);
|
|
27
|
+
let info;
|
|
28
|
+
try {
|
|
29
|
+
info = await lstat(path);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (error.code === "ENOENT") continue;
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
if (info.isSymbolicLink()) fail("contains a symbolic link");
|
|
35
|
+
if (!info.isDirectory() && !info.isFile() || info.isFile() && info.nlink !== 1) fail("contains a special or hard-linked file");
|
|
36
|
+
stats.logicalBytes += info.isFile() ? info.size : 0;
|
|
37
|
+
stats.allocatedBytes += typeof info.blocks === "number" ? info.blocks * 512 : Math.ceil(info.size / 4096) * 4096;
|
|
38
|
+
if (stats.logicalBytes > FILTERED_WORKSPACE_LIMITS.logicalBytes || stats.allocatedBytes > FILTERED_WORKSPACE_LIMITS.allocatedBytes) fail("bytes exceed its live limit");
|
|
39
|
+
if (info.isDirectory()) await walk(path, depth + 1);
|
|
40
|
+
}
|
|
41
|
+
} finally {
|
|
42
|
+
await handle.close().catch((error) => {
|
|
43
|
+
if (error.code !== "ERR_DIR_CLOSED") throw error;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
try {
|
|
48
|
+
await walk(root, 0);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
if (stopped()) return stats;
|
|
51
|
+
if (error instanceof FilteredWorkspaceLimitError) throw error;
|
|
52
|
+
throw new FilteredWorkspaceLimitError("Filtered workspace could not be safely inspected; stop the task and inspect its output");
|
|
53
|
+
}
|
|
54
|
+
return stats;
|
|
55
|
+
}
|
|
56
|
+
function monitorFilteredWorkspace(root, options) {
|
|
57
|
+
const interval = Number.isFinite(options.intervalMs) ? Math.max(20, Math.min(5e3, options.intervalMs)) : 250;
|
|
58
|
+
let stopped = options.signal.aborted, timer, pending = Promise.resolve();
|
|
59
|
+
const abort = () => {
|
|
60
|
+
stopped = true;
|
|
61
|
+
clearTimeout(timer);
|
|
62
|
+
};
|
|
63
|
+
options.signal.addEventListener("abort", abort, { once: true });
|
|
64
|
+
const scan = () => {
|
|
65
|
+
if (stopped) return;
|
|
66
|
+
pending = inspectFilteredWorkspace(root, () => stopped).then(() => {
|
|
67
|
+
if (!stopped) {
|
|
68
|
+
timer = setTimeout(scan, interval);
|
|
69
|
+
timer.unref();
|
|
70
|
+
}
|
|
71
|
+
}, (error) => {
|
|
72
|
+
if (!stopped) {
|
|
73
|
+
stopped = true;
|
|
74
|
+
try {
|
|
75
|
+
options.onExceeded(error);
|
|
76
|
+
} catch {
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
scan();
|
|
82
|
+
return { async stop() {
|
|
83
|
+
abort();
|
|
84
|
+
options.signal.removeEventListener("abort", abort);
|
|
85
|
+
await pending;
|
|
86
|
+
} };
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
FILTERED_WORKSPACE_LIMITS,
|
|
90
|
+
FilteredWorkspaceLimitError,
|
|
91
|
+
inspectFilteredWorkspace,
|
|
92
|
+
monitorFilteredWorkspace
|
|
93
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { HttpError, readJson, send } from "./http.js";
|
|
2
|
+
import { FilteredTaskError } from "./filtered-tasks.js";
|
|
3
|
+
async function handleFilteredTasksApi(req, res, url, parts, service) {
|
|
4
|
+
if (parts[0] !== "filtered-tasks") return false;
|
|
5
|
+
try {
|
|
6
|
+
const id = parts[1];
|
|
7
|
+
if (!id && parts.length === 1 && req.method === "GET") {
|
|
8
|
+
send(res, 200, service.summaries(url.searchParams.get("project") ?? void 0));
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (!id && parts.length === 1 && req.method === "POST") {
|
|
12
|
+
send(res, 202, await service.create(await readJson(req, 64 * 1024)));
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
if (id && parts.length === 2 && req.method === "GET") {
|
|
16
|
+
send(res, 200, await service.read(id));
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
if (id && parts.length === 2 && req.method === "DELETE") {
|
|
20
|
+
const body = await readJson(req, 16 * 1024);
|
|
21
|
+
send(res, 200, await service.delete(id, body.revision));
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (id && parts.length === 3 && req.method === "POST") {
|
|
25
|
+
const body = await readJson(req, 16 * 1024);
|
|
26
|
+
if (parts[2] === "preview-import") {
|
|
27
|
+
send(res, 200, await service.preview(id));
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (parts[2] === "import") {
|
|
31
|
+
send(res, 200, await service.import(id, body));
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
if (parts[2] === "cancel") {
|
|
35
|
+
await service.cancel(id, body.revision);
|
|
36
|
+
send(res, 200, service.summaries().find((job) => job.id === id));
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
if (parts[2] === "receipt") {
|
|
40
|
+
await service.reconcile(id, body.revision);
|
|
41
|
+
send(res, 200, service.summaries().find((job) => job.id === id));
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
throw new HttpError(404, "Unknown filtered task operation");
|
|
46
|
+
} catch (error) {
|
|
47
|
+
if (error instanceof FilteredTaskError) throw new HttpError(error.status, error.message);
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
handleFilteredTasksApi
|
|
53
|
+
};
|