@thinkingai/ae-cli 6.1.18 → 6.1.19

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 (96) hide show
  1. package/README.md +2 -0
  2. package/README.zh.md +6 -0
  3. package/dist/{auth-ROB2EDYV.js → auth-QPEVVBKT.js} +13 -7
  4. package/dist/auth-UMJAA72O.js +15 -0
  5. package/dist/{capability-DKMYUTLC.js → capability-ASI62I4A.js} +11 -10
  6. package/dist/{chunk-UW5UN47B.js → chunk-533JK3YX.js} +2 -0
  7. package/dist/{chunk-4XXOWOTA.js → chunk-6QK7SYYY.js} +5 -4
  8. package/dist/{chunk-TUKQZTMI.js → chunk-7K24F7T2.js} +2 -0
  9. package/dist/{chunk-OO6XR6LK.js → chunk-AMBFK2K3.js} +2 -0
  10. package/dist/{sync-HKIOZXQE.js → chunk-B5HMQAOM.js} +31 -540
  11. package/dist/{chunk-Y3LOALAV.js → chunk-DKEXH6Q5.js} +4 -3
  12. package/dist/{chunk-VTWMIC5L.js → chunk-E2JKXMVO.js} +2 -0
  13. package/dist/{chunk-JHENBQ5B.js → chunk-FR2EDAQM.js} +1 -0
  14. package/dist/{chunk-ZQ47LWTI.js → chunk-GJXRF7Y6.js} +6 -5
  15. package/dist/{chunk-DWO43OIB.js → chunk-JQ3ENZZH.js} +2 -0
  16. package/dist/chunk-JYMGHGCE.js +191 -0
  17. package/dist/{chunk-BYYS3ANB.js → chunk-KEWVSO64.js} +5 -4
  18. package/dist/{chunk-3FY3RJ26.js → chunk-KZ6ZHF5J.js} +2 -1
  19. package/dist/{chunk-ZQKDZXDO.js → chunk-O6K2ODUE.js} +3 -2
  20. package/dist/chunk-QL6R6TSK.js +25215 -0
  21. package/dist/{chunk-J2DEBMRF.js → chunk-RWXIXOZG.js} +22 -9
  22. package/dist/{chunk-QZ3AS4KK.js → chunk-S5PONFBM.js} +5 -4
  23. package/dist/{chunk-4NN5IWVN.js → chunk-T6OSFQZD.js} +2 -0
  24. package/dist/{chunk-3KWQYGYI.js → chunk-TKHSULJT.js} +2 -0
  25. package/dist/{chunk-6EIJSNBD.js → chunk-Y74WTIKJ.js} +2 -0
  26. package/dist/{client-L2YDMHQ6.js → client-N7NGZUNI.js} +4 -3
  27. package/dist/{community-report-client-C7WDGET3.js → community-report-client-6OL6GBQW.js} +3 -2
  28. package/dist/{config-BMYZX2UE.js → config-XNMACCKX.js} +8 -7
  29. package/dist/{data-integration-QEKDWQDY.js → data-integration-4NZGZ45E.js} +913 -92
  30. package/dist/index.js +38 -36
  31. package/dist/{local-data-upload-client-4YYHSYD6.js → local-data-upload-client-EFHDLXFG.js} +3 -2
  32. package/dist/{memory-I2WXDTV2.js → memory-HBJQ2GC5.js} +8 -7
  33. package/dist/{metadata-I4C2EWUN.js → metadata-62EWBEIG.js} +12 -11
  34. package/dist/{model-HLHIEFMU.js → model-BHLJ2QMT.js} +10 -9
  35. package/dist/{personal-semantic-preference-LIPACBDX.js → personal-semantic-preference-JBVMAI7L.js} +11 -10
  36. package/dist/{project-semantic-RT3R2VQD.js → project-semantic-BQ4MPUS5.js} +12 -11
  37. package/dist/sync-MUWPRM5I.js +522 -0
  38. package/dist/{te-agent-BR6VDBNX.js → te-agent-WQZTMEK4.js} +10 -9
  39. package/dist/{te-analysis-7VUNUYWZ.js → te-analysis-MNCG65LU.js} +107 -20
  40. package/dist/{te-community-5DMNKJWY.js → te-community-BNE6KREL.js} +8 -7
  41. package/dist/{te-dataops-6P5IKWNJ.js → te-dataops-TXLKM2W6.js} +467 -67
  42. package/dist/{te-engage-KZPR5R22.js → te-engage-TPKLRVTL.js} +84 -10
  43. package/dist/{te-experiment-6BITX4RD.js → te-experiment-6BYKTCY7.js} +85 -12
  44. package/dist/{te-kb-RCLSSH2Q.js → te-kb-BUD6N3NI.js} +311 -24
  45. package/dist/{te-system-FXITO2JG.js → te-system-44LZJDTQ.js} +573 -37
  46. package/dist/{te-team-ADOC2ROP.js → te-team-XMP47YXE.js} +10 -7
  47. package/dist/{update-YCYCKJOO.js → update-UODFOZ4P.js} +7 -6
  48. package/package.json +18 -9
  49. package/skills/ae-analysis/references/analysis_gateway_assets.md +1 -1
  50. package/skills/ae-analysis/references/audience_models.md +18 -0
  51. package/skills/ae-analysis/references/command_index.md +2 -2
  52. package/skills/ae-analysis/references/project_timezone_update.md +13 -4
  53. package/skills/ae-analysis/references/property_create.md +2 -0
  54. package/skills/ae-analysis/references/super_metadata_batch_create.md +2 -0
  55. package/skills/ae-analysis/references/user_cluster_models.md +2 -0
  56. package/skills/ae-analysis/references/user_cluster_update.md +8 -4
  57. package/skills/ae-analysis/references/user_tag_create.md +7 -1
  58. package/skills/ae-analysis/references/user_tag_models.md +8 -2
  59. package/skills/ae-data-integration/SKILL.md +1 -0
  60. package/skills/ae-data-integration/references/error-handling.md +54 -1
  61. package/skills/ae-data-integration/references/source-inspect.md +18 -2
  62. package/skills/ae-data-integration/references/transform.md +3 -1
  63. package/skills/ae-data-integration/references/ue-routing.md +23 -0
  64. package/skills/ae-dataops/SKILL.md +11 -1
  65. package/skills/ae-dataops/references/dataops-backfill.md +135 -0
  66. package/skills/ae-engage/SKILL.md +5 -0
  67. package/skills/ae-engage/references/build-task-save-guide.md +5 -1
  68. package/skills/ae-engage/references/save-flow.md +37 -1
  69. package/skills/ae-engage/references/save-task.md +6 -0
  70. package/skills/ae-experiment/SKILL.md +6 -2
  71. package/skills/ae-experiment/references/save_metric.md +20 -8
  72. package/skills/ae-kb/SKILL.md +120 -9
  73. package/skills/ae-system/SKILL.md +28 -30
  74. package/skills/ae-system/references/channel-management.md +303 -0
  75. package/dist/auth-GBMV6TEJ.js +0 -14
  76. package/dist/capability-HYVVPG25.js +0 -352
  77. package/dist/chunk-EFH4XWYC.js +0 -556
  78. package/dist/chunk-JRJY5DMJ.js +0 -71
  79. package/dist/chunk-OMPRXM3V.js +0 -349
  80. package/dist/chunk-QNOLN2LJ.js +0 -509
  81. package/dist/chunk-RJDU7NYP.js +0 -1198
  82. package/dist/chunk-RNAALWJK.js +0 -98
  83. package/dist/chunk-SERWF6G5.js +0 -13
  84. package/dist/memory-3ORCR7JH.js +0 -893
  85. package/dist/metadata-VUOQJE26.js +0 -339
  86. package/dist/model-UGRDX4MW.js +0 -139
  87. package/dist/personal-semantic-preference-OEISBRHM.js +0 -239
  88. package/dist/project-semantic-FFPWFPIW.js +0 -1114
  89. package/dist/sync-TFHU2UTG.js +0 -10261
  90. package/dist/te-agent-VLYOV7S4.js +0 -3894
  91. package/dist/te-analysis-4YGQL5RC.js +0 -9357
  92. package/dist/te-community-ISDQWJU7.js +0 -1859
  93. package/dist/te-dataops-CVULXNVB.js +0 -2209
  94. package/dist/te-engage-N5WI32H6.js +0 -4898
  95. package/dist/te-experiment-UVR4HLND.js +0 -988
  96. package/dist/te-system-K2GYMCTB.js +0 -2213
@@ -1,44 +1,8 @@
1
- import {
2
- SKILL_MANIFEST_FILE,
3
- assertValidMcpName,
4
- assertValidSkillSlug,
5
- describeSource,
6
- getCurrentWorkspace,
7
- readSkillManifestEntries,
8
- scanMcps,
9
- scanSkills,
10
- splitPushableMcps,
11
- writeSkillManifestEntries
12
- } from "./chunk-DWO43OIB.js";
13
- import {
14
- MultiselectCancelled,
15
- promptMultiselect,
16
- promptSingleSelect
17
- } from "./chunk-TUKQZTMI.js";
18
- import {
19
- assertSkillDocumentSize
20
- } from "./chunk-4NN5IWVN.js";
21
- import {
22
- TeAgentApiError,
23
- TeAgentCredentialsError,
24
- getSandboxSyncPullCandidates,
25
- postSandboxSyncPull,
26
- postToMainApp,
27
- uploadToMainApp
28
- } from "./chunk-QNOLN2LJ.js";
29
- import {
30
- printError
31
- } from "./chunk-BYYS3ANB.js";
32
- import "./chunk-6EIJSNBD.js";
33
- import "./chunk-J2DEBMRF.js";
34
- import "./chunk-ZQKDZXDO.js";
35
- import "./chunk-3FY3RJ26.js";
36
- import "./chunk-UW5UN47B.js";
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
37
2
  import {
38
3
  __commonJS,
39
- __require,
40
- __toESM
41
- } from "./chunk-JHENBQ5B.js";
4
+ __require
5
+ } from "./chunk-FR2EDAQM.js";
42
6
 
43
7
  // node_modules/process-nextick-args/index.js
44
8
  var require_process_nextick_args = __commonJS({
@@ -327,7 +291,7 @@ var require_BufferList = __commonJS({
327
291
  this.head = this.tail = null;
328
292
  this.length = 0;
329
293
  };
330
- BufferList.prototype.join = function join2(s) {
294
+ BufferList.prototype.join = function join(s) {
331
295
  if (this.length === 0) return "";
332
296
  var p = this.head;
333
297
  var ret = "" + p.data;
@@ -2917,8 +2881,8 @@ var require_utils = __commonJS({
2917
2881
  var result = transform[inputType][outputType](input);
2918
2882
  return result;
2919
2883
  };
2920
- exports.resolve = function(path2) {
2921
- var parts = path2.split("/");
2884
+ exports.resolve = function(path) {
2885
+ var parts = path.split("/");
2922
2886
  var result = [];
2923
2887
  for (var index = 0; index < parts.length; index++) {
2924
2888
  var part = parts[index];
@@ -8771,18 +8735,18 @@ var require_object = __commonJS({
8771
8735
  var object = new ZipObject(name, zipObjectContent, o);
8772
8736
  this.files[name] = object;
8773
8737
  };
8774
- var parentFolder = function(path2) {
8775
- if (path2.slice(-1) === "/") {
8776
- path2 = path2.substring(0, path2.length - 1);
8738
+ var parentFolder = function(path) {
8739
+ if (path.slice(-1) === "/") {
8740
+ path = path.substring(0, path.length - 1);
8777
8741
  }
8778
- var lastSlash = path2.lastIndexOf("/");
8779
- return lastSlash > 0 ? path2.substring(0, lastSlash) : "";
8742
+ var lastSlash = path.lastIndexOf("/");
8743
+ return lastSlash > 0 ? path.substring(0, lastSlash) : "";
8780
8744
  };
8781
- var forceTrailingSlash = function(path2) {
8782
- if (path2.slice(-1) !== "/") {
8783
- path2 += "/";
8745
+ var forceTrailingSlash = function(path) {
8746
+ if (path.slice(-1) !== "/") {
8747
+ path += "/";
8784
8748
  }
8785
- return path2;
8749
+ return path;
8786
8750
  };
8787
8751
  var folderAdd = function(name, createFolders) {
8788
8752
  createFolders = typeof createFolders !== "undefined" ? createFolders : defaults.createFolders;
@@ -9748,9 +9712,9 @@ var require_load = __commonJS({
9748
9712
  var require_lib3 = __commonJS({
9749
9713
  "node_modules/jszip/lib/index.js"(exports, module) {
9750
9714
  "use strict";
9751
- function JSZip2() {
9752
- if (!(this instanceof JSZip2)) {
9753
- return new JSZip2();
9715
+ function JSZip() {
9716
+ if (!(this instanceof JSZip)) {
9717
+ return new JSZip();
9754
9718
  }
9755
9719
  if (arguments.length) {
9756
9720
  throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
@@ -9759,7 +9723,7 @@ var require_lib3 = __commonJS({
9759
9723
  this.comment = null;
9760
9724
  this.root = "";
9761
9725
  this.clone = function() {
9762
- var newObj = new JSZip2();
9726
+ var newObj = new JSZip();
9763
9727
  for (var i in this) {
9764
9728
  if (typeof this[i] !== "function") {
9765
9729
  newObj[i] = this[i];
@@ -9768,494 +9732,21 @@ var require_lib3 = __commonJS({
9768
9732
  return newObj;
9769
9733
  };
9770
9734
  }
9771
- JSZip2.prototype = require_object();
9772
- JSZip2.prototype.loadAsync = require_load();
9773
- JSZip2.support = require_support();
9774
- JSZip2.defaults = require_defaults();
9775
- JSZip2.version = "3.10.1";
9776
- JSZip2.loadAsync = function(content, options) {
9777
- return new JSZip2().loadAsync(content, options);
9735
+ JSZip.prototype = require_object();
9736
+ JSZip.prototype.loadAsync = require_load();
9737
+ JSZip.support = require_support();
9738
+ JSZip.defaults = require_defaults();
9739
+ JSZip.version = "3.10.1";
9740
+ JSZip.loadAsync = function(content, options) {
9741
+ return new JSZip().loadAsync(content, options);
9778
9742
  };
9779
- JSZip2.external = require_external();
9780
- module.exports = JSZip2;
9743
+ JSZip.external = require_external();
9744
+ module.exports = JSZip;
9781
9745
  }
9782
9746
  });
9783
9747
 
9784
- // src/commands/sync/index.ts
9785
- var import_jszip = __toESM(require_lib3(), 1);
9786
- import Table from "cli-table3";
9787
- import { lstatSync, readFileSync as readFileSync2, readdirSync } from "fs";
9788
- import { join, relative } from "path";
9789
-
9790
- // src/commands/sync/local-copy.ts
9791
- import { existsSync, readFileSync, statSync, writeFileSync } from "fs";
9792
- import path from "path";
9793
- var MCP_MANIFEST_FILE = ".mcp-manifest.json";
9794
- function isMcpScope(value) {
9795
- return value === "personal" || value === "company" || value === "system";
9796
- }
9797
- function uniqueMcpEntries(entries) {
9798
- const seen = /* @__PURE__ */ new Set();
9799
- const out = [];
9800
- for (const entry of entries) {
9801
- if (seen.has(entry.name)) continue;
9802
- seen.add(entry.name);
9803
- out.push(entry);
9804
- }
9805
- return out;
9806
- }
9807
- function readMcpManifestEntries(manifestPath) {
9808
- if (!existsSync(manifestPath)) return [];
9809
- let parsed;
9810
- try {
9811
- parsed = JSON.parse(readFileSync(manifestPath, "utf8"));
9812
- } catch {
9813
- return [];
9814
- }
9815
- if (!Array.isArray(parsed)) return [];
9816
- const entries = [];
9817
- for (const item of parsed) {
9818
- if (!item || typeof item !== "object") continue;
9819
- const entry = item;
9820
- if (typeof entry.name !== "string" || !isMcpScope(entry.scope)) continue;
9821
- entries.push({ name: entry.name, scope: entry.scope });
9822
- }
9823
- return uniqueMcpEntries(entries);
9824
- }
9825
- function writeMcpManifestEntries(manifestPath, entries) {
9826
- writeFileSync(
9827
- manifestPath,
9828
- JSON.stringify(uniqueMcpEntries(entries), null, 2) + "\n",
9829
- "utf8"
9830
- );
9831
- }
9832
- function updateSkillManifestForSource(sourceDir, slug) {
9833
- assertValidSkillSlug(slug);
9834
- const sourceAbs = path.resolve(sourceDir);
9835
- if (!statSync(sourceAbs).isDirectory()) {
9836
- throw new Error(`Skill source path is not a directory: ${sourceDir}`);
9837
- }
9838
- const manifestPath = path.join(path.dirname(sourceAbs), SKILL_MANIFEST_FILE);
9839
- const manifest = readSkillManifestEntries(manifestPath);
9840
- const nextEntry = { dirName: slug, scope: "personal" };
9841
- const existingIndex = manifest.findIndex((entry) => entry.dirName === slug);
9842
- if (existingIndex >= 0 && manifest[existingIndex].scope === nextEntry.scope) {
9843
- return { manifestPath, changed: false };
9844
- }
9845
- const nextManifest = manifest.slice();
9846
- if (existingIndex >= 0) {
9847
- nextManifest[existingIndex] = nextEntry;
9848
- } else {
9849
- nextManifest.push(nextEntry);
9850
- }
9851
- writeSkillManifestEntries(manifestPath, nextManifest);
9852
- return { manifestPath, changed: true };
9853
- }
9854
- function updateMcpManifestForProjectSource(workspaceDir, name) {
9855
- assertValidMcpName(name);
9856
- const workspaceAbs = path.resolve(workspaceDir);
9857
- if (!statSync(workspaceAbs).isDirectory()) {
9858
- throw new Error(`MCP workspace path is not a directory: ${workspaceDir}`);
9859
- }
9860
- const manifestPath = path.join(workspaceAbs, MCP_MANIFEST_FILE);
9861
- const manifest = readMcpManifestEntries(manifestPath);
9862
- const nextEntry = { name, scope: "personal" };
9863
- const existingIndex = manifest.findIndex((entry) => entry.name === name);
9864
- if (existingIndex >= 0 && manifest[existingIndex].scope === nextEntry.scope) {
9865
- return { manifestPath, changed: false };
9866
- }
9867
- const nextManifest = manifest.slice();
9868
- if (existingIndex >= 0) {
9869
- nextManifest[existingIndex] = nextEntry;
9870
- } else {
9871
- nextManifest.push(nextEntry);
9872
- }
9873
- writeMcpManifestEntries(manifestPath, nextManifest);
9874
- return { manifestPath, changed: true };
9875
- }
9876
-
9877
- // src/commands/sync/index.ts
9878
- function redactEnv(env) {
9879
- if (!env) return void 0;
9880
- const out = {};
9881
- for (const [k, v] of Object.entries(env)) {
9882
- if (/TOKEN|SECRET|KEY|PASSWORD/i.test(k)) {
9883
- out[k] = "***";
9884
- } else {
9885
- out[k] = v;
9886
- }
9887
- }
9888
- return out;
9889
- }
9890
- var SOURCE_ORDER = {
9891
- global: 0,
9892
- workspace: 1,
9893
- project: 0,
9894
- local: 1,
9895
- user: 2
9896
- };
9897
- function skillToItem(s) {
9898
- return {
9899
- kind: "skill",
9900
- slug: s.slug,
9901
- scope: "personal",
9902
- source: s.source,
9903
- workspacePath: s.workspacePath,
9904
- event: "upsert",
9905
- dirPath: s.dirPath,
9906
- content: s.content,
9907
- checksum: s.checksum,
9908
- mtime: s.mtime
9909
- };
9910
- }
9911
- function mcpToItem(m, includeSecrets) {
9912
- return {
9913
- kind: "mcp",
9914
- slug: m.slug,
9915
- scope: "personal",
9916
- source: m.source,
9917
- workspacePath: m.workspacePath,
9918
- workspaceDir: m.workspaceDir,
9919
- event: "upsert",
9920
- transport: m.transport,
9921
- url: m.url,
9922
- command: m.command,
9923
- args: m.args,
9924
- env: includeSecrets ? m.env : redactEnv(m.env),
9925
- headers: m.headers
9926
- };
9927
- }
9928
- async function selectSkills() {
9929
- const all = scanSkills();
9930
- if (all.length === 0) {
9931
- process.stderr.write("No Skills found (scanned current workspace .claude/skills)\n");
9932
- return [];
9933
- }
9934
- all.sort((a, b) => {
9935
- if (a.source !== b.source) return SOURCE_ORDER[a.source] - SOURCE_ORDER[b.source];
9936
- return a.slug.localeCompare(b.slug);
9937
- });
9938
- const items = all.map((s) => ({
9939
- value: s,
9940
- label: s.slug,
9941
- group: describeSource(s),
9942
- hint: s.isSymlink ? "(symlink)" : void 0
9943
- }));
9944
- const picked = await promptMultiselect({
9945
- title: "Select Skills to push to the main app",
9946
- items
9947
- });
9948
- return picked.map(skillToItem);
9949
- }
9950
- async function selectMcps(includeSecrets) {
9951
- const all = scanMcps();
9952
- if (all.length === 0) {
9953
- process.stderr.write(
9954
- "No MCPs found (scanned current workspace .mcp.json / .claude/.claude.json and global ~/.claude.json)\n"
9955
- );
9956
- return [];
9957
- }
9958
- const { supported, unsupportedStdio } = splitPushableMcps(all);
9959
- if (unsupportedStdio.length > 0) {
9960
- const names = unsupportedStdio.map((m) => m.slug).sort().join(", ");
9961
- process.stderr.write(`ae-cli sync push only supports http/sse MCPs; skipped stdio MCPs: ${names}
9962
- `);
9963
- }
9964
- if (supported.length === 0) {
9965
- process.stderr.write("No syncable MCPs found. ae-cli sync push only supports http/sse.\n");
9966
- return [];
9967
- }
9968
- supported.sort((a, b) => {
9969
- if (a.source !== b.source) return SOURCE_ORDER[a.source] - SOURCE_ORDER[b.source];
9970
- return a.slug.localeCompare(b.slug);
9971
- });
9972
- const items = supported.map((m) => ({
9973
- value: m,
9974
- label: m.slug,
9975
- group: describeSource(m),
9976
- hint: m.hasSecrets && !includeSecrets ? "(env redacted)" : void 0
9977
- }));
9978
- const picked = await promptMultiselect({
9979
- title: "Select MCPs to push to the main app",
9980
- items
9981
- });
9982
- return picked.map((m) => mcpToItem(m, includeSecrets));
9983
- }
9984
- function renderResults(results) {
9985
- const table = new Table({
9986
- head: ["kind", "slug", "status", "message"],
9987
- wordWrap: true
9988
- });
9989
- for (const r of results) {
9990
- table.push([r.kind, r.slug, r.status, r.message ?? ""]);
9991
- }
9992
- process.stdout.write(table.toString() + "\n");
9993
- const failed = results.filter((r) => r.status === "failed").length;
9994
- if (failed > 0) {
9995
- process.stderr.write(`
9996
- \u2717 ${failed} item(s) failed
9997
- `);
9998
- }
9999
- }
10000
- async function selectPullResources(args) {
10001
- const all = args.candidates.filter((candidate) => candidate.selected).sort((a, b) => {
10002
- const scopeOrder = {
10003
- system: 0,
10004
- company: 1,
10005
- personal: 2
10006
- };
10007
- const scopeDiff = scopeOrder[a.scope] - scopeOrder[b.scope];
10008
- return scopeDiff !== 0 ? scopeDiff : a.name.localeCompare(b.name);
10009
- });
10010
- if (all.length === 0) {
10011
- process.stderr.write(`${args.title}: no candidates available to sync
10012
- `);
10013
- return [];
10014
- }
10015
- const items = all.map((candidate) => ({
10016
- value: candidate,
10017
- label: `${candidate.name} ${candidate.scope}`,
10018
- preselected: true
10019
- }));
10020
- return promptMultiselect({ title: args.title, items });
10021
- }
10022
- function toHttpItems(items) {
10023
- return items.map((item) => {
10024
- if (item.kind === "skill") {
10025
- const { kind: _kind2, dirPath: _dirPath, ...rest2 } = item;
10026
- return rest2;
10027
- }
10028
- const { kind: _kind, workspaceDir: _workspaceDir, ...rest } = item;
10029
- return rest;
10030
- });
10031
- }
10032
- async function pushItems(kind, items) {
10033
- if (items.length === 0) return { results: [] };
10034
- try {
10035
- const resp = await postToMainApp("/api/sandbox/sync/push", {
10036
- kind,
10037
- items: toHttpItems(items)
10038
- });
10039
- return { results: resp.results ?? [] };
10040
- } catch (err) {
10041
- if (err instanceof TeAgentApiError) {
10042
- return {
10043
- results: items.map((it) => ({
10044
- kind: it.kind,
10045
- slug: it.slug,
10046
- status: "failed",
10047
- message: `${err.code ?? err.status} ${err.message}`
10048
- }))
10049
- };
10050
- }
10051
- throw err;
10052
- }
10053
- }
10054
- function readSkillVersion(content) {
10055
- const frontmatter = /^---\r?\n([\s\S]*?)\r?\n---/.exec(content)?.[1];
10056
- if (!frontmatter) return void 0;
10057
- const matches = [...frontmatter.matchAll(/^version\s*:\s*(.+?)\s*(?:#.*)?$/gm)];
10058
- if (matches.length !== 1) return void 0;
10059
- const value = matches[0][1].trim().replace(/^(['"])(.*)\1$/, "$2");
10060
- return /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(value) ? value : void 0;
10061
- }
10062
- async function buildSkillZip(dirPath) {
10063
- const zip = new import_jszip.default();
10064
- const visit = (dir) => {
10065
- for (const name of readdirSync(dir)) {
10066
- if (name === ".DS_Store") continue;
10067
- const absolute = join(dir, name);
10068
- const stat = lstatSync(absolute);
10069
- if (stat.isSymbolicLink()) {
10070
- throw new Error(`Skill package contains a symlink: ${relative(dirPath, absolute)}`);
10071
- }
10072
- if (stat.isDirectory()) visit(absolute);
10073
- else if (stat.isFile()) {
10074
- const content = readFileSync2(absolute);
10075
- if (relative(dirPath, absolute).replaceAll("\\", "/") === "SKILL.md") {
10076
- assertSkillDocumentSize(content);
10077
- }
10078
- zip.file(relative(dirPath, absolute).replaceAll("\\", "/"), content);
10079
- }
10080
- }
10081
- };
10082
- visit(dirPath);
10083
- return zip.generateAsync({ type: "nodebuffer", compression: "DEFLATE" });
10084
- }
10085
- var defaultPushSkillDependencies = {
10086
- upload: (path2, formData) => uploadToMainApp(path2, formData),
10087
- updateManifest: updateSkillManifestForSource
10088
- };
10089
- async function pushSkillItems(items, dependencies = defaultPushSkillDependencies) {
10090
- const results = [];
10091
- for (const item of items) {
10092
- try {
10093
- const buffer = await buildSkillZip(item.dirPath);
10094
- const formData = new FormData();
10095
- formData.append("file", new Blob([new Uint8Array(buffer)], { type: "application/zip" }), `${item.slug}.zip`);
10096
- formData.append("slug", item.slug);
10097
- formData.append("source", item.source);
10098
- if (item.workspacePath) formData.append("workspacePath", item.workspacePath);
10099
- const version = readSkillVersion(item.content);
10100
- if (version) formData.append("version", version);
10101
- const response = await dependencies.upload("/api/sandbox/sync/push/skill", formData);
10102
- dependencies.updateManifest(item.dirPath, item.slug);
10103
- results.push({
10104
- kind: "skill",
10105
- slug: item.slug,
10106
- status: "synced",
10107
- ...!response.workspaceEnabled && item.source === "workspace" ? {
10108
- message: "Skill synced, but it was not enabled in the current workspace"
10109
- } : {}
10110
- });
10111
- } catch (err) {
10112
- const message = err instanceof TeAgentApiError ? `${err.code ?? err.status} ${err.message}` : err?.message ?? String(err);
10113
- results.push({
10114
- kind: "skill",
10115
- slug: item.slug,
10116
- status: "failed",
10117
- message
10118
- });
10119
- }
10120
- }
10121
- return { results };
10122
- }
10123
- function updateSyncedProjectMcpManifest(mcpItems, resp) {
10124
- if (mcpItems.length === 0) return;
10125
- const bySlug = new Map(mcpItems.map((item) => [item.slug, item]));
10126
- for (const result of resp.results) {
10127
- if (result.kind !== "mcp" || result.status !== "synced") continue;
10128
- const item = bySlug.get(result.slug);
10129
- if (!item || item.source !== "project") continue;
10130
- if (!item.workspaceDir) {
10131
- result.status = "failed";
10132
- result.message = "Main app synced the MCP, but local MCP manifest update failed: missing workspaceDir";
10133
- continue;
10134
- }
10135
- try {
10136
- updateMcpManifestForProjectSource(item.workspaceDir, item.slug);
10137
- } catch (err) {
10138
- result.status = "failed";
10139
- result.message = `Main app synced the MCP, but local MCP manifest update failed: ${err?.message ?? String(err)}`;
10140
- }
10141
- }
10142
- }
10143
- async function selectDirection(optsDirection) {
10144
- if (optsDirection === "push" || optsDirection === "pull") return optsDirection;
10145
- if (optsDirection) {
10146
- throw new Error("--direction must be push or pull");
10147
- }
10148
- return promptSingleSelect({
10149
- title: "Sync direction?",
10150
- items: [
10151
- { value: "push", label: "Workspace -> Main app" },
10152
- { value: "pull", label: "Main app -> Workspace" }
10153
- ]
10154
- });
10155
- }
10156
- async function selectKind(optsKind) {
10157
- if (optsKind === "skill" || optsKind === "mcp" || optsKind === "both") return optsKind;
10158
- if (optsKind) {
10159
- throw new Error("--kind must be skill, mcp, or both");
10160
- }
10161
- return promptSingleSelect({
10162
- title: "Which resource type to sync?",
10163
- items: [
10164
- { value: "skill", label: "Skills" },
10165
- { value: "mcp", label: "MCPs" },
10166
- { value: "both", label: "Skills + MCPs" }
10167
- ]
10168
- });
10169
- }
10170
- async function runPush(kind, includeSecrets) {
10171
- const skillItems = kind !== "mcp" ? await selectSkills() : [];
10172
- const mcpItems = kind !== "skill" ? await selectMcps(includeSecrets) : [];
10173
- if (skillItems.length === 0 && mcpItems.length === 0) {
10174
- process.stderr.write("Nothing selected, exiting\n");
10175
- return;
10176
- }
10177
- process.stderr.write(`Pushing ${skillItems.length} Skill(s) / ${mcpItems.length} MCP(s) ...
10178
- `);
10179
- const allResults = [];
10180
- if (skillItems.length > 0) {
10181
- const skillResp = await pushSkillItems(skillItems);
10182
- allResults.push(...skillResp.results);
10183
- }
10184
- if (mcpItems.length > 0) {
10185
- const mcpResp = await pushItems("mcp", mcpItems);
10186
- updateSyncedProjectMcpManifest(mcpItems, mcpResp);
10187
- allResults.push(...mcpResp.results);
10188
- }
10189
- renderResults(allResults);
10190
- }
10191
- function pullResultRows(resp) {
10192
- return (resp.results ?? []).map((result) => ({
10193
- kind: result.kind,
10194
- slug: result.name,
10195
- status: result.status,
10196
- message: result.message
10197
- }));
10198
- }
10199
- async function runPull(kind) {
10200
- const workspace = getCurrentWorkspace();
10201
- if (!workspace) {
10202
- throw new Error("Current workspace not recognized; please run from within /home/ta/workspaces/<workspace>");
10203
- }
10204
- const candidates = await getSandboxSyncPullCandidates({
10205
- workspacePath: workspace.name,
10206
- kind
10207
- });
10208
- const skillItems = kind !== "mcp" ? await selectPullResources({
10209
- title: "Select Skills to sync to workspace",
10210
- candidates: (candidates.skills ?? []).filter((candidate) => candidate.scope !== "system")
10211
- }) : [];
10212
- const mcpItems = kind !== "skill" ? await selectPullResources({
10213
- title: "Select MCPs to sync to workspace",
10214
- candidates: candidates.mcp ?? []
10215
- }) : [];
10216
- if (skillItems.length === 0 && mcpItems.length === 0) {
10217
- process.stderr.write("Nothing selected, exiting\n");
10218
- return;
10219
- }
10220
- process.stderr.write(`Syncing to workspace: ${skillItems.length} Skill(s) / ${mcpItems.length} MCP(s) ...
10221
- `);
10222
- const resp = await postSandboxSyncPull({
10223
- workspacePath: workspace.name,
10224
- kind,
10225
- skills: skillItems.map((item) => item.id),
10226
- mcp: mcpItems.map((item) => item.id)
10227
- });
10228
- renderResults(pullResultRows(resp));
10229
- }
10230
- function registerSync(program) {
10231
- program.command("sync").description("Sync Skills / MCPs between current workspace and te-claude main app").option("--direction <direction>", "push | pull (skip interactive direction picker)").option("--include-secrets", "Include MCP env secrets (TOKEN/SECRET/KEY) in push", false).option("--kind <kind>", "skill | mcp | both (skip interactive picker)").action(async (opts) => {
10232
- try {
10233
- const direction = await selectDirection(opts.direction);
10234
- const kind = await selectKind(opts.kind);
10235
- if (direction === "push") await runPush(kind, !!opts.includeSecrets);
10236
- else await runPull(kind);
10237
- } catch (err) {
10238
- if (err instanceof MultiselectCancelled) {
10239
- process.stderr.write("Cancelled\n");
10240
- return;
10241
- }
10242
- if (err instanceof TeAgentCredentialsError) {
10243
- printError("config", err.message, err.hint);
10244
- process.exit(1);
10245
- }
10246
- if (err instanceof TeAgentApiError) {
10247
- printError("api", err.message, err.code);
10248
- process.exit(1);
10249
- }
10250
- const e = err;
10251
- printError("api", e?.message ?? String(err));
10252
- process.exit(1);
10253
- }
10254
- });
10255
- }
10256
9748
  export {
10257
- buildSkillZip,
10258
- pushSkillItems,
10259
- readSkillVersion,
10260
- registerSync
9749
+ require_inherits,
9750
+ require_node,
9751
+ require_lib3 as require_lib
10261
9752
  };
@@ -1,14 +1,15 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
1
2
  import {
2
3
  resolveGatewayDomain
3
- } from "./chunk-3KWQYGYI.js";
4
+ } from "./chunk-TKHSULJT.js";
4
5
  import {
5
6
  withOutputMetadata
6
- } from "./chunk-BYYS3ANB.js";
7
+ } from "./chunk-KEWVSO64.js";
7
8
  import {
8
9
  dryRunCapability,
9
10
  executeCapabilityWithEnvelope,
10
11
  validateCapability
11
- } from "./chunk-ZQ47LWTI.js";
12
+ } from "./chunk-GJXRF7Y6.js";
12
13
 
13
14
  // src/core/capability-command.ts
14
15
  import { randomBytes } from "crypto";
@@ -1,3 +1,5 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+
1
3
  // src/core/package-info.ts
2
4
  import fs from "fs";
3
5
  import path from "path";
@@ -1,3 +1,4 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,19 +1,20 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
1
2
  import {
2
3
  internalCallSourceHeaders
3
- } from "./chunk-SERWF6G5.js";
4
+ } from "./chunk-Y74WTIKJ.js";
4
5
  import {
5
6
  clearCliToken,
6
7
  getCliToken
7
- } from "./chunk-J2DEBMRF.js";
8
+ } from "./chunk-RWXIXOZG.js";
8
9
  import {
9
10
  safeJsonParse
10
- } from "./chunk-3FY3RJ26.js";
11
+ } from "./chunk-KZ6ZHF5J.js";
11
12
  import {
12
13
  PermissionError
13
- } from "./chunk-UW5UN47B.js";
14
+ } from "./chunk-533JK3YX.js";
14
15
  import {
15
16
  logger
16
- } from "./chunk-JHENBQ5B.js";
17
+ } from "./chunk-FR2EDAQM.js";
17
18
 
18
19
  // src/core/capability-api.ts
19
20
  import { readFile } from "fs/promises";
@@ -1,3 +1,5 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+
1
3
  // src/commands/sync/scanners.ts
2
4
  import { createHash } from "crypto";
3
5
  import { readdirSync, readFileSync as readFileSync2, statSync, lstatSync, existsSync as existsSync2, realpathSync } from "fs";