@antelopejs/dms-ai 0.2.0 → 0.3.0

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 (41) hide show
  1. package/README.md +3 -1
  2. package/dist/constants/frontend-module.d.ts +2 -0
  3. package/dist/constants/frontend-module.js +6 -1
  4. package/dist/constants/frontend-module.js.map +1 -1
  5. package/dist/constants/pages.d.ts +4 -4
  6. package/dist/constants/pages.js +4 -4
  7. package/dist/constants/pages.js.map +1 -1
  8. package/dist/index.js +1 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/pages/skills/page.js +0 -2
  11. package/dist/pages/skills/page.js.map +1 -1
  12. package/frontend-vue/app/components/ActivityDetail.vue +11 -13
  13. package/frontend-vue/app/components/ChangesView.vue +56 -49
  14. package/frontend-vue/app/plugins/ai.client.ts +16 -6
  15. package/frontend-vue/app/runtime/assistant-activity.ts +38 -21
  16. package/frontend-vue/app/runtime/sidecar-status.ts +78 -56
  17. package/frontend-vue/app/views/ChangeSetPanel.vue +13 -18
  18. package/frontend-vue/app/views/UnavailableState.vue +1 -1
  19. package/frontend-vue/app/views/composables/useAiData.ts +116 -0
  20. package/frontend-vue/app/views/composables/useAssistant.ts +8 -2
  21. package/frontend-vue/app/views/composables/useChangeSetActions.ts +7 -6
  22. package/frontend-vue/app/views/constants.ts +1 -1
  23. package/frontend-vue/app/views/utils/change-sets.ts +0 -7
  24. package/frontend-vue/package.json +1 -1
  25. package/frontend-vue/tests/assistant-activity.test.ts +69 -0
  26. package/frontend-vue/tests/chat/markdown.test.ts +1 -0
  27. package/frontend-vue/tests/chat-panel.test.ts +1 -0
  28. package/frontend-vue/tests/host-commands.test.ts +1 -0
  29. package/frontend-vue/tests/navigation.test.ts +1 -0
  30. package/frontend-vue/tests/palette-assistant.test.ts +1 -0
  31. package/frontend-vue/tests/panel-states.test.ts +6 -1
  32. package/frontend-vue/tests/sidecar-guest.test.ts +1 -1
  33. package/frontend-vue/tests/sidecar-status.test.ts +93 -15
  34. package/frontend-vue/tests/support/dms-frontend-module.ts +9 -0
  35. package/frontend-vue/tests/views/api-data-reads.test.ts +445 -0
  36. package/frontend-vue/tests/views/diff-view.test.ts +1 -0
  37. package/frontend-vue/tests/views/use-assistant.test.ts +53 -0
  38. package/frontend-vue/vitest.config.ts +14 -1
  39. package/package.json +3 -3
  40. package/sidecar/package.json +2 -1
  41. package/frontend-vue/app/views/composables/useAiRequest.ts +0 -89
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/dms-ai",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,6 +37,7 @@
37
37
  "lint:fix": "oxlint --disable-nested-config --fix --max-warnings=1000000 && oxfmt --disable-nested-config . && cd frontend-vue && pnpm lint:fix && cd ../sidecar && pnpm lint:fix",
38
38
  "typecheck": "tsc --noEmit && cd frontend-vue && pnpm typecheck:chat && pnpm typecheck && cd ../sidecar && pnpm typecheck",
39
39
  "test": "cd sidecar && pnpm test && cd ../frontend-vue && pnpm test",
40
+ "test:node": "([ -n \"$DMS_PREBUILT\" ] || pnpm run build) && node --test \"tests/!(sidecar-build).test.cjs\"",
40
41
  "test:sidecar-smoke": "pnpm run build:sidecar && node --test tests/sidecar-build.test.cjs",
41
42
  "test:frontend-registration": "pnpm run build && node --test tests/frontend-registration.test.cjs",
42
43
  "test:channels": "pnpm run build && node --test tests/channels.test.cjs tests/channel-limits.test.cjs",
@@ -44,7 +45,6 @@
44
45
  "test:spawn-args": "node --test tests/spawn-args.test.cjs",
45
46
  "test:sidecar-lifecycle": "node --test tests/sidecar-lifecycle.test.cjs",
46
47
  "test:build-id": "node --test tests/build-id.test.cjs",
47
- "test:release-script": "node --test tests/release-script.test.cjs",
48
48
  "test:e2e": "cd sidecar && pnpm test:e2e",
49
49
  "release": "pnpm --dir frontend-vue install --frozen-lockfile && pnpm --dir sidecar install --frozen-lockfile && release-it",
50
50
  "format": "oxfmt --disable-nested-config . && cd frontend-vue && pnpm format",
@@ -54,7 +54,7 @@
54
54
  "dependencies": {
55
55
  "@antelopejs/interface-api": ">=0.0.14 <1.0.0",
56
56
  "@antelopejs/interface-core": ">=0.1.1 <1.0.0",
57
- "@antelopejs/interface-dms": ">=0.5.13 <1.0.0",
57
+ "@antelopejs/interface-dms": ">=0.7.0 <1.0.0",
58
58
  "@anthropic-ai/claude-agent-sdk": "^0.2.131",
59
59
  "@anthropic-ai/claude-code": "^2.1.131",
60
60
  "@modelcontextprotocol/sdk": "1.29.0",
@@ -13,7 +13,8 @@
13
13
  "typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
14
14
  "lint": "oxlint && oxfmt --check .",
15
15
  "lint:fix": "oxlint --fix --max-warnings=1000000 && oxfmt .",
16
- "test": "vitest run --passWithNoTests",
16
+ "test": "vitest run --passWithNoTests --exclude tests/integration/codex-acceptance.test.ts",
17
+ "test:acceptance": "vitest run tests/integration/codex-acceptance.test.ts",
17
18
  "generate:codex-types": "node scripts/generate-codex-types.mjs",
18
19
  "test:e2e": "echo 'no e2e yet' && exit 0",
19
20
  "format": "oxfmt .",
@@ -1,89 +0,0 @@
1
- import { ref, shallowRef, type Ref, type ShallowRef } from "vue";
2
- import { HTTP_SERVICE_UNAVAILABLE } from "../constants";
3
-
4
- /** Why a request failed: the sidecar is down (503), or anything else. */
5
- export type RequestFailure = "unavailable" | "error";
6
-
7
- export interface AiRequest<T> {
8
- data: ShallowRef<T | null>;
9
- isLoading: Ref<boolean>;
10
- failure: Ref<RequestFailure | null>;
11
- message: Ref<string>;
12
- /**
13
- * Runs `fetcher`, keeping the previous data while it loads; a run that a
14
- * later one overtook is dropped.
15
- */
16
- run: (fetcher: () => Promise<T>) => Promise<T | null>;
17
- }
18
-
19
- interface FetchErrorResponse {
20
- status?: number;
21
- }
22
-
23
- interface FetchErrorBody {
24
- message?: unknown;
25
- }
26
-
27
- interface FetchErrorLike {
28
- status?: number;
29
- statusCode?: number;
30
- response?: FetchErrorResponse;
31
- data?: FetchErrorBody;
32
- message?: string;
33
- }
34
-
35
- /** The HTTP status of a `$authFetch` rejection, if it got an answer. */
36
- function errorStatus(error: unknown): number | undefined {
37
- const candidate = error as FetchErrorLike | null;
38
- return (
39
- candidate?.status ?? candidate?.statusCode ?? candidate?.response?.status
40
- );
41
- }
42
-
43
- /** The server's `{ message }`, else the error's own text. */
44
- export function errorMessage(error: unknown): string {
45
- const candidate = error as FetchErrorLike | null;
46
- const serverMessage = candidate?.data?.message;
47
- if (typeof serverMessage === "string") return serverMessage;
48
- return candidate?.message ?? String(error);
49
- }
50
-
51
- export function classifyFailure(error: unknown): RequestFailure {
52
- return errorStatus(error) === HTTP_SERVICE_UNAVAILABLE
53
- ? "unavailable"
54
- : "error";
55
- }
56
-
57
- /**
58
- * One request's state for a view: its data, whether it loads, and whether a
59
- * failure means "the assistant isn't running" (503) rather than an error.
60
- */
61
- export function useAiRequest<T>(): AiRequest<T> {
62
- const data = shallowRef<T | null>(null);
63
- const isLoading = ref(false);
64
- const failure = ref<RequestFailure | null>(null);
65
- const message = ref("");
66
- let latestRun = 0;
67
-
68
- async function run(fetcher: () => Promise<T>): Promise<T | null> {
69
- latestRun += 1;
70
- const runId = latestRun;
71
- isLoading.value = true;
72
- try {
73
- const result = await fetcher();
74
- if (runId !== latestRun) return null;
75
- data.value = result;
76
- failure.value = null;
77
- return result;
78
- } catch (error) {
79
- if (runId !== latestRun) return null;
80
- failure.value = classifyFailure(error);
81
- message.value = errorMessage(error);
82
- return null;
83
- } finally {
84
- if (runId === latestRun) isLoading.value = false;
85
- }
86
- }
87
-
88
- return { data, isLoading, failure, message, run };
89
- }