agentlas 0.9.10 → 1.0.2

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.
Files changed (145) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/README.md +319 -341
  3. package/bin/agentlas.cjs +32 -9
  4. package/engine/agentlas-banner.cjs +24 -3
  5. package/engine/agentlas-composer.cjs +239 -31
  6. package/engine/agentlas-config.cjs +103 -7
  7. package/engine/agentlas-core-harness.cjs +48 -4
  8. package/engine/agentlas-evolution.cjs +3 -4
  9. package/engine/agentlas-i18n.cjs +88 -32
  10. package/engine/agentlas-input.cjs +234 -18
  11. package/engine/agentlas-memory-governance.cjs +3 -5
  12. package/engine/agentlas-memory-import.cjs +3 -3
  13. package/engine/agentlas-native-host.cjs +200 -9
  14. package/engine/agentlas-onboard.cjs +112 -20
  15. package/engine/agentlas-permissions.cjs +14 -7
  16. package/engine/agentlas-sqlite-policy.cjs +34 -0
  17. package/engine/agentlas-ui.cjs +93 -42
  18. package/engine/agentlas-workforce.cjs +472 -58
  19. package/engine/agentlas-workload-routing.cjs +8 -3
  20. package/engine/agentlas.cjs +140 -12367
  21. package/engine/agents/files.cjs +61 -0
  22. package/engine/agents/import-local.cjs +237 -0
  23. package/engine/agents/registry.cjs +158 -0
  24. package/engine/agents/router.cjs +565 -0
  25. package/engine/agents/routes.cjs +43 -0
  26. package/engine/architecture.data.json +2 -2
  27. package/engine/automation/daemon.cjs +335 -0
  28. package/engine/automation/schedule.cjs +181 -0
  29. package/engine/automation/store.cjs +209 -0
  30. package/engine/cloud/auth.cjs +279 -0
  31. package/engine/cloud/hub-client.cjs +239 -0
  32. package/engine/cloud-assets/cargo.cjs +49 -0
  33. package/engine/cloud-assets/cas.cjs +235 -0
  34. package/engine/cloud-assets/commands.cjs +273 -0
  35. package/engine/cloud-assets/package.cjs +936 -0
  36. package/engine/cloud-assets/restore.cjs +172 -0
  37. package/engine/cloud-assets/state.cjs +268 -0
  38. package/engine/commands/automation.cjs +195 -0
  39. package/engine/commands/billing.cjs +96 -0
  40. package/engine/commands/browser.cjs +20 -0
  41. package/engine/commands/build.cjs +33 -0
  42. package/engine/commands/call.cjs +24 -0
  43. package/engine/commands/career-graph.cjs +51 -0
  44. package/engine/commands/cd.cjs +22 -0
  45. package/engine/commands/chat.cjs +12 -0
  46. package/engine/commands/chats.cjs +28 -0
  47. package/engine/commands/cloud.cjs +17 -0
  48. package/engine/commands/connect.cjs +20 -0
  49. package/engine/commands/context.cjs +66 -0
  50. package/engine/commands/creds.cjs +203 -0
  51. package/engine/commands/doctor.cjs +68 -0
  52. package/engine/commands/env.cjs +33 -0
  53. package/engine/commands/evolve.cjs +23 -0
  54. package/engine/commands/experience.cjs +34 -0
  55. package/engine/commands/film.cjs +8 -0
  56. package/engine/commands/firm.cjs +115 -0
  57. package/engine/commands/help.cjs +65 -0
  58. package/engine/commands/hep.cjs +23 -0
  59. package/engine/commands/import.cjs +35 -0
  60. package/engine/commands/index.cjs +136 -0
  61. package/engine/commands/install.cjs +27 -0
  62. package/engine/commands/journal.cjs +31 -0
  63. package/engine/commands/legacy-network.cjs +29 -0
  64. package/engine/commands/list.cjs +49 -0
  65. package/engine/commands/login.cjs +68 -0
  66. package/engine/commands/logout.cjs +28 -0
  67. package/engine/commands/mcp.cjs +91 -0
  68. package/engine/commands/memory.cjs +21 -0
  69. package/engine/commands/multimodal.cjs +91 -0
  70. package/engine/commands/native.cjs +34 -0
  71. package/engine/commands/netadmin.cjs +31 -0
  72. package/engine/commands/oberon.cjs +70 -0
  73. package/engine/commands/ontology.cjs +24 -0
  74. package/engine/commands/open.cjs +48 -0
  75. package/engine/commands/plugin.cjs +101 -0
  76. package/engine/commands/project.cjs +47 -0
  77. package/engine/commands/research.cjs +36 -0
  78. package/engine/commands/route.cjs +37 -0
  79. package/engine/commands/run.cjs +149 -0
  80. package/engine/commands/search.cjs +55 -0
  81. package/engine/commands/setup.cjs +45 -0
  82. package/engine/commands/storm.cjs +75 -0
  83. package/engine/commands/swarm.cjs +75 -0
  84. package/engine/commands/telegram.cjs +32 -0
  85. package/engine/commands/uninstall.cjs +68 -0
  86. package/engine/commands/update.cjs +54 -0
  87. package/engine/commands/upload.cjs +18 -0
  88. package/engine/commands/usage.cjs +35 -0
  89. package/engine/commands/variant.cjs +25 -0
  90. package/engine/commands/version.cjs +9 -0
  91. package/engine/commands/whoami.cjs +38 -0
  92. package/engine/commands/workforce.cjs +103 -0
  93. package/engine/core/db.cjs +160 -0
  94. package/engine/core/paths.cjs +35 -0
  95. package/engine/experience/build.cjs +181 -0
  96. package/engine/experience/intents.cjs +492 -0
  97. package/engine/experience/runtime.cjs +242 -0
  98. package/engine/experience/variant.cjs +196 -0
  99. package/engine/firms/orchestrate.cjs +333 -0
  100. package/engine/hephaestus/runtime.cjs +697 -0
  101. package/engine/hub/install.cjs +872 -0
  102. package/engine/hub/plugins.cjs +213 -0
  103. package/engine/mcp/consent.cjs +289 -0
  104. package/engine/mcp/contract.cjs +202 -0
  105. package/engine/mcp/index.cjs +43 -0
  106. package/engine/mcp/inventory.cjs +322 -0
  107. package/engine/mcp/plan.cjs +286 -0
  108. package/engine/mcp/probe.cjs +151 -0
  109. package/engine/memory-cli/curate.cjs +163 -0
  110. package/engine/oberon/common.cjs +69 -0
  111. package/engine/oberon/manifest.cjs +164 -0
  112. package/engine/oberon/outputs.cjs +70 -0
  113. package/engine/oberon/render.cjs +164 -0
  114. package/engine/project/career-graph.cjs +249 -0
  115. package/engine/project/credentials.cjs +262 -0
  116. package/engine/project/env-file.cjs +46 -0
  117. package/engine/project/index.cjs +27 -0
  118. package/engine/project/memory-context.cjs +453 -0
  119. package/engine/project/ontology.cjs +467 -0
  120. package/engine/project/paths.cjs +39 -0
  121. package/engine/project/seed.cjs +200 -0
  122. package/engine/project/state.cjs +403 -0
  123. package/engine/project/super-ontology-seed.json +3288 -0
  124. package/engine/runtimes/detect.cjs +54 -0
  125. package/engine/runtimes/overrides.cjs +139 -0
  126. package/engine/runtimes/resolve.cjs +64 -0
  127. package/engine/sessions/apply-fences.cjs +188 -0
  128. package/engine/sessions/fences.cjs +362 -0
  129. package/engine/sessions/orchestrator.cjs +170 -0
  130. package/engine/sessions/prompt.cjs +212 -0
  131. package/engine/sessions/session.cjs +245 -0
  132. package/engine/sessions/sink.cjs +54 -0
  133. package/engine/sessions/store.cjs +79 -0
  134. package/engine/storm/deps.cjs +88 -0
  135. package/engine/storm/storm.cjs +218 -0
  136. package/engine/storm/swarm.cjs +422 -0
  137. package/engine/ui/palette.cjs +105 -0
  138. package/engine/ui/renderer.cjs +85 -0
  139. package/engine/ui/repl.cjs +444 -0
  140. package/engine/workforce/capture.cjs +701 -0
  141. package/engine/workforce/deps.cjs +472 -0
  142. package/package.json +2 -6
  143. package/engine/agentlas-experience-mcp.cjs +0 -1709
  144. package/engine/agentlas-parity.cjs +0 -1499
  145. package/engine/agentlas-repl.cjs +0 -1780
@@ -0,0 +1,273 @@
1
+ "use strict";
2
+ /*
3
+ * cloud-assets/commands — `agentlas cloud …` / `agentlas upload …` 명령 글루.
4
+ *
5
+ * 가시성 계약(v1 문구 그대로 — 절대 완화 금지):
6
+ * - `cloud save` = 소유자 전용 저장. --visibility marketplace 는 정확한 v1
7
+ * 오류로 거절한다 ("`agentlas cloud save` is owner-private. …").
8
+ * - `cloud publish` = 공개 Hub 발행. --visibility private-link 도 거절.
9
+ * - 최상위 `upload <path>` 는 기본 owner-private save. marketplace 는
10
+ * 명시적 --visibility marketplace 로만 publish가 된다.
11
+ * 오류는 throw → 명령 파일이 ctx.err + return 1 로 처리한다 (process.exit 금지).
12
+ */
13
+ const cloudRuntime = require("../agentlas-cloud-runtime.cjs");
14
+ const { installHubAgent } = require("../hub/install.cjs");
15
+ const { callHubTool, HubError } = require("../cloud/hub-client.cjs");
16
+ const { packageCloudAgent } = require("./package.cjs");
17
+ const { deleteCloudAgent } = require("./cas.cjs");
18
+ const { listOwnedCloudAgents, restoreOwnedCloudAgent } = require("./restore.cjs");
19
+
20
+ function parseCloudFlags(args) {
21
+ const flags = { _: [] };
22
+ for (let i = 0; i < args.length; i++) {
23
+ const a = args[i];
24
+ if (a && a.startsWith("--")) {
25
+ const key = a.slice(2);
26
+ const next = args[i + 1];
27
+ if (next !== undefined && !String(next).startsWith("--")) {
28
+ flags[key] = next;
29
+ i++;
30
+ } else {
31
+ flags[key] = true;
32
+ }
33
+ } else {
34
+ flags._.push(a);
35
+ }
36
+ }
37
+ return flags;
38
+ }
39
+
40
+ function cloudVisibilityFlag(value) {
41
+ if (value == null) return null;
42
+ if (value === "private-link" || value === "marketplace") return value;
43
+ throw new Error("--visibility must be private-link or marketplace");
44
+ }
45
+
46
+ function cloudVisibilityForAction(sub, flags) {
47
+ const explicit = cloudVisibilityFlag(flags.visibility);
48
+ if (sub === "save") {
49
+ if (explicit === "marketplace") {
50
+ // v1 문구 그대로 — save가 조용히 공개 발행으로 승격되는 일은 절대 없다.
51
+ throw new Error("`agentlas cloud save` is owner-private. Use `agentlas cloud publish` for the public Hub.");
52
+ }
53
+ return "private-link";
54
+ }
55
+ if (sub === "publish") {
56
+ if (explicit === "private-link") {
57
+ throw new Error("`agentlas cloud publish` is public Hub publication. Use `agentlas cloud save` for owner-private Agent Cloud storage.");
58
+ }
59
+ return "marketplace";
60
+ }
61
+ if (explicit) return explicit;
62
+ return "private-link";
63
+ }
64
+
65
+ /** 최상위 `upload`의 실제 동작 결정: 기본 save, 명시적 marketplace만 publish. */
66
+ function cloudActionForTopLevelUpload(args) {
67
+ const flags = parseCloudFlags(args);
68
+ return cloudVisibilityFlag(flags.visibility) === "marketplace" ? "publish" : "save";
69
+ }
70
+
71
+ function printCloudPackageResult(ctx, result) {
72
+ const mark = result.status === "blocked" ? ctx.ui.red("✖") : ctx.ui.green("✓");
73
+ ctx.out(`${mark} ${result.summary}`);
74
+ ctx.out(` target: ${result.manifest.visibility === "marketplace" ? "Agentlas Hub (public)" : "Agent Cloud (owner-private)"}`);
75
+ ctx.out(` slug: ${result.manifest.slug}`);
76
+ ctx.out(` files: ${result.manifest.includedFileCount}/${result.manifest.fileCount}`);
77
+ ctx.out(` hash: ${result.manifest.packageHash}`);
78
+ ctx.out(` bundle: ${result.bundlePath}`);
79
+ ctx.out(` review: ${result.review.mode} · cost=${result.review.costOwner}${result.review.runtimeLabel ? " · " + result.review.runtimeLabel : ""}`);
80
+ const findings = result.review.findings || [];
81
+ if (findings.length) {
82
+ ctx.out(" findings:");
83
+ for (const f of findings.slice(0, 20)) ctx.out(` - ${f.severity} ${f.file ? f.file + ": " : ""}${f.message}`);
84
+ }
85
+ if (result.registration) {
86
+ const label = result.manifest.visibility === "marketplace" ? "hub" : "cloud";
87
+ ctx.out(` ${label}: ${result.registration.marketplaceUrl || result.registration.url || result.registration.cloudId}`);
88
+ if (result.registration.localStateWarning) ctx.out(` warning: ${result.registration.localStateWarning}`);
89
+ }
90
+ }
91
+
92
+ const CLOUD_HELP = [
93
+ "agentlas cloud",
94
+ "",
95
+ " wizard <path> [--name name] [--json] generate/repair agentlas.json",
96
+ " security scan <path> [--strict] scan risky instructions and secret paths",
97
+ " runtime bundle <path> [--json] compile runtime bundle from agentlas.json",
98
+ " runtime read-agent-file <path> <file>",
99
+ " lazy read with allow/deny gates",
100
+ " field-test [--json] run local Cloud contract field test",
101
+ " save <path> [--dry-run] [--slug name]",
102
+ " save owner-private in Agent Cloud (default upload)",
103
+ " publish <path> [--dry-run] [--slug name]",
104
+ " explicitly publish to the public Agentlas Hub",
105
+ " package <path> [--json] [--visibility private-link|marketplace]",
106
+ " package only; defaults to private-save checks",
107
+ " list [--json] list packages in your private Agent Cloud",
108
+ " restore <slug> [--json] restore an owned Cloud package on this machine",
109
+ " install <slug> compatibility alias: install from the public Hub",
110
+ " delete <slug> [--scope owner-private|hub-public] [--json]",
111
+ " conditionally delete one exact observed Cloud revision",
112
+ " search \"<what you need>\" [--limit 10]",
113
+ " search the public Hub (no sign-in needed)",
114
+ "",
115
+ "Private save rule: no public review or routing card; local secret/path/hash checks remain.",
116
+ ].join("\n");
117
+
118
+ async function runCloud(ctx, args) {
119
+ const sub = args[0] || "help";
120
+ if (sub === "help" || sub === "--help" || sub === "-h") {
121
+ ctx.out(CLOUD_HELP);
122
+ return 0;
123
+ }
124
+ if (sub === "search") {
125
+ const flags = parseCloudFlags(args.slice(1));
126
+ const query = flags._.join(" ").trim();
127
+ if (!query) {
128
+ ctx.err('usage: agentlas cloud search "<what you need>" [--limit 10]');
129
+ return 1;
130
+ }
131
+ const limit = Math.max(1, Math.min(30, Number(flags.limit) || 10));
132
+ let result;
133
+ try {
134
+ result = await callHubTool("marketplace.search_agents", { q: query, query, limit });
135
+ } catch (e) {
136
+ ctx.err(e instanceof HubError ? e.message : `Marketplace connection failed: ${(e && e.message) || e}`);
137
+ return 1;
138
+ }
139
+ const items = (result && (result.results || result.agents || result.items)) || [];
140
+ if (!Array.isArray(items) || !items.length) {
141
+ ctx.out(`No results for "${query}"`);
142
+ return 0;
143
+ }
144
+ for (const it of items.slice(0, limit)) {
145
+ ctx.out(`${String(it.slug || it.id || "?").padEnd(34).slice(0, 34)} ${String(it.name || it.title || "").slice(0, 40)}`);
146
+ }
147
+ return 0;
148
+ }
149
+ if (sub === "list") {
150
+ const flags = parseCloudFlags(args.slice(1));
151
+ const result = await listOwnedCloudAgents(Number(flags.limit || 100));
152
+ if (flags.json) { ctx.out(JSON.stringify(result, null, 2)); return 0; }
153
+ const agents = Array.isArray(result.results) ? result.results : [];
154
+ if (!agents.length) { ctx.out("No agents are stored in Private Agent Cloud."); return 0; }
155
+ for (const agent of agents) ctx.out(`${agent.slug}\t${agent.name || agent.nameEn || agent.slug}\t${agent.entityKind || "agent"}`);
156
+ return 0;
157
+ }
158
+ if (sub === "restore") {
159
+ const flags = parseCloudFlags(args.slice(1));
160
+ const slug = flags._[0];
161
+ if (!slug) { ctx.err("usage: agentlas cloud restore <slug> [--json]"); return 1; }
162
+ const result = await restoreOwnedCloudAgent(ctx.db(), slug);
163
+ if (flags.json) { ctx.out(JSON.stringify(result, null, 2)); return 0; }
164
+ ctx.out(`${ctx.ui.green("✓")} restored ${result.slug} from private Agent Cloud`);
165
+ ctx.out(` hash: ${result.packageHash}`);
166
+ if (result.localPath) ctx.out(` files: ${result.localPath}`);
167
+ if (result.localStateWarning) ctx.out(` warning: ${result.localStateWarning}`);
168
+ return 0;
169
+ }
170
+ if (sub === "delete" || sub === "unpublish") {
171
+ const flags = parseCloudFlags(args.slice(1));
172
+ const slug = flags._[0];
173
+ if (!slug) { ctx.err(`usage: agentlas cloud ${sub} <slug> [--json]`); return 1; }
174
+ const result = await deleteCloudAgent(slug, { scope: flags.scope });
175
+ ctx.out(flags.json ? JSON.stringify(result, null, 2) : `${ctx.ui.green("✓")} deleted ${result.slug || slug}`);
176
+ if (!flags.json && Array.isArray(result.localStateWarnings)) {
177
+ for (const warning of result.localStateWarnings) ctx.out(` warning: ${warning}`);
178
+ }
179
+ return 0;
180
+ }
181
+ // ── agentlas-cloud-runtime 소비 지점 (스캔/매니페스트/lazy-read/필드테스트) ──
182
+ if (sub === "wizard") {
183
+ const flags = parseCloudFlags(args.slice(1));
184
+ const root = flags._[0];
185
+ if (!root) { ctx.err("usage: agentlas cloud wizard <path> [--name name]"); return 1; }
186
+ const result = cloudRuntime.runWizard(root, { name: typeof flags.name === "string" ? flags.name : undefined });
187
+ ctx.out(flags.json ? JSON.stringify(result, null, 2) : `${result.status}: ${result.manifest.name} (${result.manifest.entry})`);
188
+ return 0;
189
+ }
190
+ if (sub === "security") {
191
+ if (args[1] !== "scan") { ctx.err("usage: agentlas cloud security scan <path> [--strict]"); return 1; }
192
+ const flags = parseCloudFlags(args.slice(2));
193
+ const root = flags._[0];
194
+ if (!root) { ctx.err("usage: agentlas cloud security scan <path> [--strict]"); return 1; }
195
+ const report = cloudRuntime.scanFolder(root);
196
+ ctx.out(JSON.stringify(report, null, 2));
197
+ return flags.strict && report.verdict === "BLOCK" ? 1 : 0;
198
+ }
199
+ if (sub === "runtime") {
200
+ const action = args[1];
201
+ if (action === "bundle") {
202
+ const root = args[2];
203
+ if (!root) { ctx.err("usage: agentlas cloud runtime bundle <path>"); return 1; }
204
+ ctx.out(JSON.stringify(cloudRuntime.compileBundle(root), null, 2));
205
+ return 0;
206
+ }
207
+ if (action === "read-agent-file") {
208
+ const root = args[2];
209
+ const targetPath = args[3];
210
+ if (!root || !targetPath) { ctx.err("usage: agentlas cloud runtime read-agent-file <path> <file>"); return 1; }
211
+ ctx.out(JSON.stringify(cloudRuntime.readAgentFile(root, targetPath), null, 2));
212
+ return 0;
213
+ }
214
+ ctx.err("usage: agentlas cloud runtime <bundle|read-agent-file> ...");
215
+ return 1;
216
+ }
217
+ if (sub === "field-test") {
218
+ const flags = parseCloudFlags(args.slice(1));
219
+ const result = cloudRuntime.runFieldTest();
220
+ ctx.out(flags.json ? JSON.stringify(result, null, 2) : `${result.suite}: ${result.status}`);
221
+ return result.status === "PASS" ? 0 : 1;
222
+ }
223
+ if (sub === "install") {
224
+ const slug = args[1];
225
+ if (!slug) { ctx.err("usage: agentlas cloud install <slug>"); return 1; }
226
+ const agent = await installHubAgent(ctx.db(), slug);
227
+ ctx.out(`${ctx.ui.green("✓")} Hub installed ${agent.slug} — ${agent.name}`);
228
+ if (agent.localPath) ctx.out(` files: ${agent.localPath}`);
229
+ return 0;
230
+ }
231
+ if (sub !== "package" && sub !== "save" && sub !== "publish") {
232
+ ctx.err("usage: agentlas cloud <save|publish|package|list|restore|install|delete|field-test> ...");
233
+ return 1;
234
+ }
235
+ const flags = parseCloudFlags(args.slice(1));
236
+ const root = flags._[0];
237
+ if (!root) { ctx.err(`usage: agentlas cloud ${sub} <path>`); return 1; }
238
+ const visibility = cloudVisibilityForAction(sub, flags);
239
+ const dryRun = sub === "package" || Boolean(flags["dry-run"]);
240
+ const result = await packageCloudAgent(ctx.db(), root, {
241
+ slug: typeof flags.slug === "string" ? flags.slug : undefined,
242
+ visibility,
243
+ llmReview: Boolean(flags["llm-review"]),
244
+ dryRun,
245
+ });
246
+ if (flags.json) {
247
+ ctx.out(JSON.stringify(result, null, 2));
248
+ return (sub === "save" || sub === "publish") && result.status === "blocked" ? 1 : 0;
249
+ }
250
+ printCloudPackageResult(ctx, result);
251
+ return (sub === "save" || sub === "publish") && result.status === "blocked" ? 1 : 0;
252
+ }
253
+
254
+ async function runUpload(ctx, args) {
255
+ if (!args.length) {
256
+ ctx.err("usage: agentlas upload <path> [--visibility marketplace]");
257
+ return 1;
258
+ }
259
+ // 기본 = owner-private save. marketplace는 오직 명시적 플래그로만 publish가 된다.
260
+ // --visibility 인자는 그대로 넘긴다 — cloudVisibilityForAction이 재검증한다.
261
+ const action = cloudActionForTopLevelUpload(args);
262
+ return runCloud(ctx, [action, ...args]);
263
+ }
264
+
265
+ module.exports = {
266
+ parseCloudFlags,
267
+ cloudVisibilityFlag,
268
+ cloudVisibilityForAction,
269
+ cloudActionForTopLevelUpload,
270
+ printCloudPackageResult,
271
+ runCloud,
272
+ runUpload,
273
+ };