@aiti-ai/ext-shared 0.0.0-stage → 0.1.11

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 (131) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -2
  3. package/agent-accounts.test.mjs +227 -0
  4. package/agent-accounts.ts +324 -0
  5. package/agent-capability-contract.test.mjs +129 -0
  6. package/agent-interaction.test.mjs +194 -0
  7. package/agent-interaction.ts +340 -0
  8. package/agent-launch.test.mjs +262 -0
  9. package/agent-spawn-env.test.mjs +169 -0
  10. package/agent-spawn-env.ts +548 -0
  11. package/aiti-editor-inject.mjs +49 -0
  12. package/backend-queue.test.mjs +336 -0
  13. package/backend-queue.ts +469 -0
  14. package/blob-save-route.ts +128 -0
  15. package/cbc-model-catalog.ts +86 -0
  16. package/check-client.mjs +273 -0
  17. package/check-ext-globals.mjs +144 -0
  18. package/controlled-login-dialog.mjs +270 -0
  19. package/controlled-login.mjs +398 -0
  20. package/controlled-login.test.mjs +466 -0
  21. package/convert-saveas.test.mjs +39 -0
  22. package/convert-saveas.ts +170 -0
  23. package/copy-client-bundle.mjs +39 -0
  24. package/cursor-cli-store.ts +377 -0
  25. package/dedupe-fetch.test.mjs +71 -0
  26. package/dedupe-fetch.ts +58 -0
  27. package/deploy-commit.mjs +52 -0
  28. package/dev-pack.mjs +246 -0
  29. package/dock-icons.ts +127 -0
  30. package/esbuild-bin.test.mjs +53 -0
  31. package/esbuild-bin.ts +66 -0
  32. package/exec-async.test.mjs +86 -0
  33. package/exec-async.ts +179 -0
  34. package/ext-display-names.ts +91 -0
  35. package/ext-entry-contracts.test.mjs +131 -0
  36. package/ext-float-dock-core.test.mjs +348 -0
  37. package/ext-float-dock-core.ts +783 -0
  38. package/ext-float-dock-lite.ts +52 -0
  39. package/ext-float-dock.test.mjs +286 -0
  40. package/ext-float-dock.ts +740 -0
  41. package/ext-icons-deploy.mjs +24 -0
  42. package/ext-lazy.test.mjs +186 -0
  43. package/ext-lazy.tsx +183 -0
  44. package/ext-model-state.test.mjs +272 -0
  45. package/ext-model-state.ts +324 -0
  46. package/ext-protocol.mjs +113 -0
  47. package/ext-protocol.test.mjs +88 -0
  48. package/ext-session-usage.test.mjs +219 -0
  49. package/ext-session-usage.ts +507 -0
  50. package/external-cli-governance.ts +153 -0
  51. package/git-ops-client/api.mjs +56 -0
  52. package/git-ops-client/branch-panel.tsx +987 -0
  53. package/git-ops-client/i18n.mjs +328 -0
  54. package/host-tools-allow.test.mjs +46 -0
  55. package/host-tools-allow.ts +84 -0
  56. package/icons/alert.svg +1 -0
  57. package/icons/bookmark.svg +1 -0
  58. package/icons/bot.svg +1 -0
  59. package/icons/chart-column.svg +1 -0
  60. package/icons/check-circle.svg +1 -0
  61. package/icons/clipboard-list.svg +1 -0
  62. package/icons/clock.svg +1 -0
  63. package/icons/coffee.svg +1 -0
  64. package/icons/edit.svg +1 -0
  65. package/icons/eye.svg +1 -0
  66. package/icons/git-branch.svg +1 -0
  67. package/icons/git-commit-horizontal.svg +1 -0
  68. package/icons/globe.svg +1 -0
  69. package/icons/history.svg +1 -0
  70. package/icons/import.svg +1 -0
  71. package/icons/inbox.svg +1 -0
  72. package/icons/key-round.svg +1 -0
  73. package/icons/layout-grid.svg +1 -0
  74. package/icons/mail.svg +1 -0
  75. package/icons/message-circle.svg +1 -0
  76. package/icons/message-square.svg +1 -0
  77. package/icons/meter-vertical.svg +1 -0
  78. package/icons/mic.svg +1 -0
  79. package/icons/monitor.svg +1 -0
  80. package/icons/pen-line.svg +1 -0
  81. package/icons/plug.svg +1 -0
  82. package/icons/radio-dot.svg +1 -0
  83. package/icons/radio.svg +1 -0
  84. package/icons/refresh.svg +1 -0
  85. package/icons/rocket.svg +1 -0
  86. package/icons/search.svg +1 -0
  87. package/icons/shield.svg +1 -0
  88. package/icons/sparkles.svg +1 -0
  89. package/icons/square-kanban.svg +1 -0
  90. package/icons/terminal.svg +1 -0
  91. package/icons/users.svg +1 -0
  92. package/icons/volume-2.svg +1 -0
  93. package/icons/wand.svg +1 -0
  94. package/icons/wrench.svg +1 -0
  95. package/icons/x-circle.svg +1 -0
  96. package/icons/x.svg +1 -0
  97. package/ignore-semantics.ts +76 -0
  98. package/lazy-loading-metrics.mjs +61 -0
  99. package/new-session-cwd.test.mjs +389 -0
  100. package/new-session-cwd.ts +253 -0
  101. package/open-viewer-window.ts +65 -0
  102. package/overlay-back-client.test.mjs +123 -0
  103. package/overlay-back-client.ts +87 -0
  104. package/package.json +65 -4
  105. package/pi-fork-rpc/README.md +12 -0
  106. package/pi-fork-rpc/cli-resolve.test.mjs +42 -0
  107. package/pi-fork-rpc/cli-resolve.ts +79 -0
  108. package/pi-fork-rpc/remote-queue.test.mjs +100 -0
  109. package/pi-fork-rpc/remote-queue.ts +140 -0
  110. package/pi-fork-rpc/spec.ts +106 -0
  111. package/pi-fork-rpc/wire.test.mjs +260 -0
  112. package/pi-fork-rpc/wire.ts +367 -0
  113. package/popup-anchor.ts +45 -0
  114. package/provider-priority-contract.test.mjs +55 -0
  115. package/reconcile-deps.mjs +41 -0
  116. package/reload-instances.mjs +60 -0
  117. package/seed-tool.test.mjs +95 -0
  118. package/seed-tool.ts +88 -0
  119. package/session-recycle.ts +109 -0
  120. package/shared-copy-sync.test.mjs +115 -0
  121. package/soffice-locate.ts +171 -0
  122. package/soffice-panel.ts +239 -0
  123. package/sync-dir.mjs +91 -0
  124. package/sync-dir.test.mjs +101 -0
  125. package/sync-gate.test.mjs +93 -0
  126. package/sync-mirror.test.mjs +85 -0
  127. package/task-list.test.mjs +91 -0
  128. package/task-list.ts +118 -0
  129. package/test-rm-rf.mjs +33 -0
  130. package/ui-dialogs.test.mjs +198 -0
  131. package/ui-dialogs.ts +310 -0
@@ -0,0 +1,56 @@
1
+ /**
2
+ * git-ops-client · REST 封装(方案 docs/aiti-git-ops-shared-plan.md §2)。
3
+ *
4
+ * 两扩展(session-manager / aiti-folder)bundle 源引共享(构建期内联,ext-float-dock 范式)。
5
+ * apiUrl 由消费方注入(host-shim 透出,basePath 感知);全部 POST + JSON body(cwd 不落 URL)。
6
+ * 返回统一 { status, data },网络失败 → { status: 0, data: { ok:false, error } }——不 throw。
7
+ */
8
+ const BASE = "/api/extensions/aiti-git-ops/git";
9
+
10
+ export function createGitOpsApi({ apiUrl = (p) => p, fetchImpl = (...a) => fetch(...a) } = {}) {
11
+ const call = async (path, body) => {
12
+ try {
13
+ const res = await fetchImpl(apiUrl(BASE + path), {
14
+ method: "POST",
15
+ headers: { "Content-Type": "application/json" },
16
+ body: JSON.stringify(body ?? {}),
17
+ });
18
+ const data = await res.json().catch(() => ({ ok: false, error: "HTTP " + res.status }));
19
+ return { status: res.status, data };
20
+ } catch (e) {
21
+ return { status: 0, data: { ok: false, error: e instanceof Error ? e.message : String(e) } };
22
+ }
23
+ };
24
+ return {
25
+ refs: (cwd) => call("/refs", { cwd }),
26
+ log: (cwd, cursor) => call("/log", { cwd, cursor: cursor || 0 }),
27
+ checkout: (cwd, ref, mode) => call("/checkout", { cwd, ref, mode }),
28
+ branchCreate: (cwd, name, from, checkout = true) => call("/branch-create", { cwd, name, from, checkout }),
29
+ branchDelete: (cwd, name) => call("/branch-delete", { cwd, name }),
30
+ tagCreate: (cwd, name, ref, opts) => call("/tag-create", { cwd, name, ref, ...opts }),
31
+ commitShow: (cwd, sha) => call("/commit-show", { cwd, sha }),
32
+ commitDiff: (cwd, sha, paths) => call("/commit-diff", { cwd, sha, paths }),
33
+ cherryPick: (cwd, sha, opts) => call("/cherry-pick", { cwd, sha, ...opts }),
34
+ stage: (cwd, paths) => call("/stage", { cwd, paths }),
35
+ unstage: (cwd, paths) => call("/unstage", { cwd, paths }),
36
+ discard: (cwd, paths) => call("/discard", { cwd, paths }),
37
+ commit: (cwd, message, amend) => call("/commit", { cwd, message, amend }),
38
+ planExecute: (cwd, groups) => call("/plan/execute", { cwd, groups }),
39
+ planRollback: (cwd, baseHEAD) => call("/plan/rollback", { cwd, baseHEAD }),
40
+ stashList: (cwd) => call("/stash/list", { cwd }),
41
+ stashFiles: (cwd, index) => call("/stash/files", { cwd, index }),
42
+ stashPush: (cwd, opts) => call("/stash/push", { cwd, ...opts }),
43
+ stashApply: (cwd, index, opts) => call("/stash/apply", { cwd, index, ...opts }),
44
+ stashDrop: (cwd, index) => call("/stash/drop", { cwd, index }),
45
+ stashBranch: (cwd, index, name) => call("/stash/branch", { cwd, index, name }),
46
+ push: (cwd, opts) => call("/push", { cwd, ...opts }),
47
+ pull: (cwd, mode) => call("/pull", { cwd, mode }),
48
+ };
49
+ }
50
+
51
+ /** 引擎在位探测(挂载门控):任一调 404 = aiti-git-ops 缺席/禁用。 */
52
+ export async function probeGitOps(apiUrl, fetchImpl) {
53
+ const api = createGitOpsApi({ apiUrl, fetchImpl });
54
+ const r = await api.refs("");
55
+ return r.status !== 404;
56
+ }