@aiti-ai/ext-shared 0.0.0-stage → 0.1.8
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/agent-accounts.test.mjs +227 -0
- package/agent-accounts.ts +324 -0
- package/agent-capability-contract.test.mjs +129 -0
- package/agent-interaction.test.mjs +194 -0
- package/agent-interaction.ts +340 -0
- package/agent-launch.test.mjs +262 -0
- package/agent-spawn-env.test.mjs +169 -0
- package/agent-spawn-env.ts +548 -0
- package/aiti-editor-inject.mjs +49 -0
- package/backend-queue.test.mjs +336 -0
- package/backend-queue.ts +469 -0
- package/blob-save-route.ts +128 -0
- package/cbc-model-catalog.ts +86 -0
- package/check-client.mjs +273 -0
- package/check-ext-globals.mjs +144 -0
- package/controlled-login-dialog.mjs +270 -0
- package/controlled-login.mjs +398 -0
- package/controlled-login.test.mjs +466 -0
- package/convert-saveas.test.mjs +39 -0
- package/convert-saveas.ts +170 -0
- package/copy-client-bundle.mjs +39 -0
- package/cursor-cli-store.ts +377 -0
- package/dedupe-fetch.test.mjs +71 -0
- package/dedupe-fetch.ts +58 -0
- package/deploy-commit.mjs +52 -0
- package/dev-pack.mjs +246 -0
- package/dock-icons.ts +127 -0
- package/esbuild-bin.test.mjs +53 -0
- package/esbuild-bin.ts +66 -0
- package/exec-async.test.mjs +86 -0
- package/exec-async.ts +179 -0
- package/ext-display-names.ts +91 -0
- package/ext-entry-contracts.test.mjs +131 -0
- package/ext-float-dock-core.test.mjs +348 -0
- package/ext-float-dock-core.ts +783 -0
- package/ext-float-dock-lite.ts +52 -0
- package/ext-float-dock.test.mjs +286 -0
- package/ext-float-dock.ts +740 -0
- package/ext-icons-deploy.mjs +24 -0
- package/ext-lazy.test.mjs +186 -0
- package/ext-lazy.tsx +183 -0
- package/ext-model-state.test.mjs +272 -0
- package/ext-model-state.ts +324 -0
- package/ext-protocol.mjs +113 -0
- package/ext-protocol.test.mjs +88 -0
- package/ext-session-usage.test.mjs +219 -0
- package/ext-session-usage.ts +507 -0
- package/external-cli-governance.ts +153 -0
- package/git-ops-client/api.mjs +56 -0
- package/git-ops-client/branch-panel.tsx +987 -0
- package/git-ops-client/i18n.mjs +328 -0
- package/host-tools-allow.test.mjs +46 -0
- package/host-tools-allow.ts +84 -0
- package/icons/alert.svg +1 -0
- package/icons/bookmark.svg +1 -0
- package/icons/bot.svg +1 -0
- package/icons/chart-column.svg +1 -0
- package/icons/check-circle.svg +1 -0
- package/icons/clipboard-list.svg +1 -0
- package/icons/clock.svg +1 -0
- package/icons/coffee.svg +1 -0
- package/icons/edit.svg +1 -0
- package/icons/eye.svg +1 -0
- package/icons/git-branch.svg +1 -0
- package/icons/git-commit-horizontal.svg +1 -0
- package/icons/globe.svg +1 -0
- package/icons/history.svg +1 -0
- package/icons/import.svg +1 -0
- package/icons/inbox.svg +1 -0
- package/icons/key-round.svg +1 -0
- package/icons/layout-grid.svg +1 -0
- package/icons/mail.svg +1 -0
- package/icons/message-circle.svg +1 -0
- package/icons/message-square.svg +1 -0
- package/icons/meter-vertical.svg +1 -0
- package/icons/mic.svg +1 -0
- package/icons/monitor.svg +1 -0
- package/icons/pen-line.svg +1 -0
- package/icons/plug.svg +1 -0
- package/icons/radio-dot.svg +1 -0
- package/icons/radio.svg +1 -0
- package/icons/refresh.svg +1 -0
- package/icons/rocket.svg +1 -0
- package/icons/search.svg +1 -0
- package/icons/shield.svg +1 -0
- package/icons/sparkles.svg +1 -0
- package/icons/square-kanban.svg +1 -0
- package/icons/terminal.svg +1 -0
- package/icons/users.svg +1 -0
- package/icons/volume-2.svg +1 -0
- package/icons/wand.svg +1 -0
- package/icons/wrench.svg +1 -0
- package/icons/x-circle.svg +1 -0
- package/icons/x.svg +1 -0
- package/ignore-semantics.ts +76 -0
- package/lazy-loading-metrics.mjs +61 -0
- package/new-session-cwd.test.mjs +389 -0
- package/new-session-cwd.ts +253 -0
- package/open-viewer-window.ts +65 -0
- package/overlay-back-client.test.mjs +123 -0
- package/overlay-back-client.ts +87 -0
- package/package.json +65 -4
- package/pi-fork-rpc/README.md +12 -0
- package/pi-fork-rpc/cli-resolve.test.mjs +42 -0
- package/pi-fork-rpc/cli-resolve.ts +79 -0
- package/pi-fork-rpc/remote-queue.test.mjs +100 -0
- package/pi-fork-rpc/remote-queue.ts +140 -0
- package/pi-fork-rpc/spec.ts +106 -0
- package/pi-fork-rpc/wire.test.mjs +260 -0
- package/pi-fork-rpc/wire.ts +367 -0
- package/popup-anchor.ts +45 -0
- package/provider-priority-contract.test.mjs +55 -0
- package/reconcile-deps.mjs +41 -0
- package/reload-instances.mjs +60 -0
- package/seed-tool.test.mjs +95 -0
- package/seed-tool.ts +88 -0
- package/session-recycle.ts +109 -0
- package/shared-copy-sync.test.mjs +115 -0
- package/soffice-locate.ts +171 -0
- package/soffice-panel.ts +239 -0
- package/sync-dir.mjs +91 -0
- package/sync-dir.test.mjs +101 -0
- package/sync-gate.test.mjs +93 -0
- package/sync-mirror.test.mjs +85 -0
- package/task-list.test.mjs +91 -0
- package/task-list.ts +118 -0
- package/test-rm-rf.mjs +33 -0
- package/ui-dialogs.test.mjs +198 -0
- package/ui-dialogs.ts +310 -0
- package/README.md +0 -3
|
@@ -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
|
+
}
|