@nimiplatform/app-tools 0.14.0 → 0.16.0-rc.12
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/README.md +112 -24
- package/bin/nimi-app.mjs +35 -15
- package/lib/app-access-declaration.mjs +3 -0
- package/lib/app-dependency-combinations.mjs +70 -24
- package/lib/app-doctor-update.mjs +97 -39
- package/lib/app-host-support.mjs +6 -0
- package/lib/app-identifiers.mjs +27 -0
- package/lib/app-info.mjs +292 -1
- package/lib/app-lifecycle-guidance.mjs +1 -1
- package/lib/app-pack.mjs +65 -39
- package/lib/app-project-lifecycle.mjs +149 -244
- package/lib/app-scaffold-capabilities.mjs +13 -109
- package/lib/app-scaffold-profiles.mjs +81 -115
- package/lib/app-scaffold.mjs +74 -166
- package/lib/app-toolchain-updates.mjs +45 -0
- package/lib/canonical-capability-ids.generated.mjs +2 -0
- package/lib/development-environment.d.mts +10 -0
- package/lib/development-environment.mjs +39 -0
- package/lib/hosted-web-release.mjs +98 -0
- package/lib/index.mjs +43 -3
- package/lib/mobile-development.mjs +19 -0
- package/lib/realm-environments.generated.mjs +5 -0
- package/lib/storefront-media.mjs +154 -0
- package/lib/web-coordination.mjs +59 -0
- package/lib/web-development.d.mts +23 -0
- package/lib/web-development.mjs +118 -0
- package/lib/web-scaffold.mjs +125 -0
- package/package.json +33 -21
- package/scripts/dev-shell.mjs +4 -1
- package/scripts/sync-scaffold-versions.mjs +0 -2
- package/skills/nimi-app-lifecycle/SKILL.md +3 -1
- package/skills/nimi-app-lifecycle/references/acceptance.md +6 -2
- package/skills/nimi-app-lifecycle/references/adapt.md +5 -3
- package/skills/nimi-app-lifecycle/references/audit.md +3 -2
- package/skills/nimi-app-lifecycle/references/create.md +6 -2
- package/skills/nimi-app-lifecycle/references/release.md +10 -0
- package/skills/nimi-app-lifecycle/references/upgrade-platform.md +12 -7
- package/templates/app-source/src/ai-studio-core/ai-studio-core.css +87 -52
- package/templates/app-source/src/ai-studio-core/history-policy.ts +45 -11
- package/templates/app-source/src/ai-studio-core/history.ts +22 -11
- package/templates/app-source/src/ai-studio-core/host-context.tsx +9 -4
- package/templates/app-source/src/ai-studio-core/index.ts +2 -0
- package/templates/app-source/src/ai-studio-core/job-recovery-panel.tsx +15 -5
- package/templates/app-source/src/ai-studio-core/job-recovery.ts +2 -2
- package/templates/app-source/src/ai-studio-core/messages/en.json +73 -19
- package/templates/app-source/src/ai-studio-core/messages/zh.json +73 -19
- package/templates/app-source/src/ai-studio-core/module-registration.ts +1 -0
- package/templates/app-source/src/ai-studio-core/non-success-presentation.ts +30 -5
- package/templates/app-source/src/ai-studio-core/parameter-fields.tsx +12 -6
- package/templates/app-source/src/ai-studio-core/parameters.ts +4 -0
- package/templates/app-source/src/ai-studio-core/prompt-drafts.ts +42 -0
- package/templates/app-source/src/ai-studio-core/runtime-types.ts +9 -2
- package/templates/app-source/src/ai-studio-core/runtime.ts +8 -4
- package/templates/app-source/src/ai-studio-core/section-ai-testing-composer.tsx +98 -90
- package/templates/app-source/src/ai-studio-core/section-ai-testing-exchange-result.tsx +1 -1
- package/templates/app-source/src/ai-studio-core/section-ai-testing-history.tsx +205 -48
- package/templates/app-source/src/ai-studio-core/section-ai-testing-input.ts +1 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-output.tsx +36 -14
- package/templates/app-source/src/ai-studio-core/section-ai-testing-result.tsx +96 -75
- package/templates/app-source/src/ai-studio-core/section-ai-testing-run.ts +59 -16
- package/templates/app-source/src/ai-studio-core/section-ai-testing-session-result.tsx +2 -0
- package/templates/app-source/src/ai-studio-core/section-ai-testing-studio-result.tsx +12 -21
- package/templates/app-source/src/ai-studio-core/section-ai-testing-transcription-result.tsx +2 -2
- package/templates/app-source/src/ai-studio-core/section-ai-testing-vision-result.tsx +3 -3
- package/templates/app-source/src/ai-studio-core/section-ai-testing.tsx +158 -76
- package/templates/app-source/src/ai-studio-core/workspace.tsx +49 -22
- package/templates/app-source/src/product-modules/agent-center/index.tsx +2 -3
- package/templates/app-source/src/product-modules/agent-conversation/index.tsx +2 -3
- package/templates/app-source/src/studio-modules/studio-create/messages/en.json +12 -3
- package/templates/app-source/src/studio-modules/studio-create/messages/zh.json +12 -3
- package/templates/app-source/src/studio-modules/studio-create/parameter-panel.tsx +11 -2
- package/templates/app-source/src/studio-modules/studio-create/parameters.ts +2 -1
- package/templates/app-source/src/studio-modules/studio-create/runtime.ts +47 -5
- package/templates/app-source/src/studio-modules/studio-media/messages/en.json +59 -8
- package/templates/app-source/src/studio-modules/studio-media/messages/zh.json +68 -8
- package/templates/app-source/src/studio-modules/studio-media/music-parameters.tsx +2 -1
- package/templates/app-source/src/studio-modules/studio-media/parameter-panel.tsx +271 -83
- package/templates/app-source/src/studio-modules/studio-media/parameters.ts +120 -2
- package/templates/app-source/src/studio-modules/studio-media/registration.ts +1 -0
- package/templates/app-source/src/studio-modules/studio-media/runtime.ts +24 -14
- package/templates/app-source/src/studio-modules/studio-voice/descriptors.ts +1 -1
- package/templates/app-source/src/studio-modules/studio-voice/messages/en.json +3 -2
- package/templates/app-source/src/studio-modules/studio-voice/messages/zh.json +3 -2
- package/templates/app-source/src/studio-modules/studio-voice/parameter-panel.tsx +46 -23
- package/templates/app-source/src/studio-modules/studio-voice/registration.ts +2 -1
- package/templates/app-source/src/studio-modules/studio-voice/runtime.ts +2 -2
- package/templates/app-source/src/workbench-core/workbench-core.tsx +27 -3
- package/templates/default-starter/AGENTS.md +3 -3
- package/templates/default-starter/README.md +1 -1
- package/templates/default-starter/src/shell/App.tsx +6 -18
- package/templates/default-starter/src/shell/auth/local-app-client.ts +6 -15
- package/templates/default-starter/src/shell/auth/runtime-platform.ts +7 -107
- package/templates/default-starter/src/shell/workbench-target-adapter.ts +9 -126
- package/templates/default-starter.manifest.json +0 -16
- package/templates/hosted-web-release.yml +98 -0
- package/templates/default-starter/src-tauri/Cargo.toml +0 -17
- package/templates/default-starter/src-tauri/build.rs +0 -32
- package/templates/default-starter/src-tauri/capabilities/default.json +0 -7
- package/templates/default-starter/src-tauri/tauri.conf.json +0 -26
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@scope (.nimi-ui-module--lab) {
|
|
2
2
|
@scope (.nimi-workbench-host) {
|
|
3
|
-
.workbench{ --nimi-ui-module-lab-studio-work-width:
|
|
3
|
+
.workbench{ --nimi-ui-module-lab-studio-work-width: 840px; --nimi-ui-module-lab-studio-gutter: clamp(14px, 3cqw, 24px); --nimi-ui-module-lab-studio-side-panel-width: min(360px, calc(100cqw - 48px));}
|
|
4
4
|
.studio-history-toggle{ display: grid; place-items: center; width: 40px; height: 38px; border: 0; border-radius: 999px; background: transparent; box-shadow: none; color: color-mix(in srgb, var(--nimi-text-muted) 64%, transparent); cursor: pointer; transition: background-color 180ms ease, color 180ms ease;}
|
|
5
5
|
.studio-history-toggle:hover{ background: var(--nimi-action-ghost-hover); color: color-mix(in srgb, var(--nimi-text-secondary) 62%, transparent);}
|
|
6
6
|
.studio-history-toggle:focus-visible{ outline: 2px solid var(--nimi-focus-ring-color); outline-offset: 2px;}
|
|
@@ -13,11 +13,24 @@
|
|
|
13
13
|
.studio{ min-width: 0; height: 100%;}
|
|
14
14
|
.studio__workspace{ display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; height: 100%;}
|
|
15
15
|
.studio__workspace--with-history{ grid-template-columns: minmax(0, 1fr) auto;}
|
|
16
|
-
.
|
|
17
|
-
.
|
|
16
|
+
.studio__workspace--overlay-history{ position: relative; grid-template-rows: minmax(0, 1fr);}
|
|
17
|
+
.studio__workspace--overlay-history .studio-history-shell{ position: absolute; inset-block: 0; inset-inline-end: 0; width: min(380px, 100%); transition: none;}
|
|
18
|
+
.studio__workspace--overlay-history .studio-history-shell--collapsed{ visibility: hidden;}
|
|
19
|
+
.studio__workspace--overlay-history .studio-history{ box-shadow: var(--nimi-elevation-raised);}
|
|
20
|
+
.studio-history__comparison{ display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex-basis: 100%; font-size: var(--nimi-type-caption-size);}
|
|
21
|
+
.studio-recent__compare-row{ display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 4px;}
|
|
22
|
+
.studio-recent__compare-row > input{ margin: 12px 2px 0;}
|
|
23
|
+
.studio__primary{ display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; background: var(--nimi-surface-panel);}
|
|
24
|
+
.studio__head{ display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 14px; border-bottom: 1px solid var(--nimi-border-subtle); padding: 14px max(var(--nimi-ui-module-lab-studio-gutter), calc((100% - var(--nimi-ui-module-lab-studio-work-width)) / 2));}
|
|
25
|
+
.studio__heading{ display: grid; gap: 6px; min-width: 0;}
|
|
18
26
|
.studio__title,
|
|
19
|
-
.
|
|
20
|
-
.
|
|
27
|
+
.studio__status,
|
|
28
|
+
.studio__head-actions{ display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-width: 0;}
|
|
29
|
+
.studio__title h2{ margin: 0; color: var(--nimi-text-primary); font-size: 22px; font-weight: var(--nimi-type-page-title-weight); line-height: 1.2;}
|
|
30
|
+
.studio__title code{ color: var(--nimi-text-secondary); font-size: 11px; overflow-wrap: anywhere;}
|
|
31
|
+
.studio__head-actions{ justify-content: end;}
|
|
32
|
+
.studio__head-alert{ grid-column: 1 / -1;}
|
|
33
|
+
.studio__runtime-state{ color: var(--nimi-text-secondary); font-size: var(--nimi-type-caption-size);}
|
|
21
34
|
.studio__stage{ min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); grid-auto-rows: auto;}
|
|
22
35
|
.studio-recovery{ min-width: 0; border-top: 1px solid var(--nimi-border-subtle);}
|
|
23
36
|
.studio-recovery > summary{ padding: 10px 18px; cursor: pointer; color: var(--nimi-text-secondary); font-size: 13px; line-height: 20px;}
|
|
@@ -25,26 +38,40 @@
|
|
|
25
38
|
.studio-recovery__state{ float: right; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--nimi-text-muted); font-size: 12px;}
|
|
26
39
|
.studio-recovery__body{ display: grid; gap: 12px; max-height: min(320px, 40vh); overflow: auto; padding: 0 18px 12px;}
|
|
27
40
|
.studio-recovery__body p{ margin: 0; overflow-wrap: anywhere;}
|
|
28
|
-
.studio-start
|
|
29
|
-
.studio-
|
|
30
|
-
.studio-
|
|
31
|
-
.studio-
|
|
32
|
-
.studio-
|
|
33
|
-
.studio-
|
|
34
|
-
.studio-turn{ display: grid; gap:
|
|
35
|
-
.studio-turn__label{ display: flex; align-items: center; gap:
|
|
36
|
-
.studio-
|
|
41
|
+
.studio-start,
|
|
42
|
+
.studio-thread__scroll{ min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 20px var(--nimi-ui-module-lab-studio-gutter) 32px;}
|
|
43
|
+
.studio-start:focus-visible,
|
|
44
|
+
.studio-thread__scroll:focus-visible{ outline: 2px solid var(--nimi-focus-ring-color); outline-offset: -2px;}
|
|
45
|
+
.studio-thread{ display: grid; grid-template-rows: minmax(0, 1fr); min-height: 0;}
|
|
46
|
+
.studio-thread__scroll{ container-type: size;}
|
|
47
|
+
.studio-turn{ display: grid; gap: 10px; max-width: var(--nimi-ui-module-lab-studio-work-width); margin: 0 auto 14px;}
|
|
48
|
+
.studio-turn__label{ display: flex; align-items: center; gap: 7px; color: var(--nimi-text-primary); font-size: 14px; font-weight: var(--nimi-type-label-weight);}
|
|
49
|
+
.studio-review-disclosure{ max-width: var(--nimi-ui-module-lab-studio-work-width); margin: 0 auto 8px; border: 1px solid var(--nimi-border-subtle); border-radius: var(--nimi-radius-md); background: var(--nimi-surface-card);}
|
|
50
|
+
.studio-review-disclosure > summary{ display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; color: var(--nimi-text-secondary); font-size: 13px; font-weight: var(--nimi-type-label-weight); list-style: none;}
|
|
51
|
+
.studio-review-disclosure > summary::-webkit-details-marker{ display: none;}
|
|
52
|
+
.studio-review-disclosure > summary::after{ content: ""; width: 6px; height: 6px; margin-inline-start: auto; border-inline-end: 1px solid currentColor; border-block-end: 1px solid currentColor; transform: rotate(-45deg);}
|
|
53
|
+
.studio-review-disclosure[open] > summary::after{ transform: rotate(45deg);}
|
|
54
|
+
.studio-review-disclosure > summary:hover{ background: var(--nimi-surface-hover);}
|
|
55
|
+
.studio-review-disclosure > summary:focus-visible{ outline: 2px solid var(--nimi-focus-ring-color); outline-offset: -2px;}
|
|
56
|
+
.studio-review-disclosure__body{ display: grid; gap: 10px; border-top: 1px solid var(--nimi-border-subtle); padding: 12px 14px;}
|
|
57
|
+
.studio-review-disclosure__body .studio-input{ border: 0; padding: 0;}
|
|
58
|
+
.studio-review-disclosure__prompt{ margin: 0; color: var(--nimi-text-secondary); font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;}
|
|
37
59
|
.studio-composer{ display: grid; gap: 10px; width: 100%; max-width: var(--nimi-ui-module-lab-studio-work-width); margin: 0 auto;}
|
|
38
|
-
.studio-input{ position: relative; display: flex; flex-direction: column; gap:
|
|
39
|
-
.studio-
|
|
40
|
-
.studio-
|
|
60
|
+
.studio-input{ position: relative; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--nimi-border-subtle); border-radius: var(--nimi-radius-md); background: var(--nimi-surface-card); padding: 16px;}
|
|
61
|
+
.studio-input__note{ margin: 0; color: var(--nimi-text-secondary);}
|
|
62
|
+
.studio-composer__heading{ display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; min-width: 0;}
|
|
63
|
+
.studio-composer__heading h3{ margin: 0; color: var(--nimi-text-primary); font-size: 16px; font-weight: var(--nimi-type-label-weight);}
|
|
64
|
+
.studio-composer__field{ display: grid; gap: 5px; min-width: 0; border: 1px solid var(--nimi-border-subtle); border-radius: var(--nimi-radius-sm); background: var(--nimi-surface-panel); padding: 9px 11px;}
|
|
65
|
+
.studio-composer__field > label{ color: var(--nimi-text-secondary); font-size: 12px; font-weight: var(--nimi-type-label-weight);}
|
|
66
|
+
.studio-composer__field:focus-within{ outline: 2px solid var(--nimi-focus-ring-color); outline-offset: 1px;}
|
|
41
67
|
.studio-context{ display: none;}
|
|
42
68
|
.studio-context--open{ display: block; border-top: 1px solid var(--nimi-border-subtle); padding-top: 10px;}
|
|
43
69
|
.studio-parameters-drawer{ display: none;}
|
|
44
70
|
.studio-parameters-drawer--open{ display: block; max-height: min(420px, 52cqh); overflow: auto; border-top: 1px solid var(--nimi-border-subtle); padding: 12px 6px 2px 0;}
|
|
71
|
+
.studio-parameters-drawer--with-primary{ display: block; max-height: min(480px, 48vh); overflow: auto;}
|
|
72
|
+
.studio-parameters-drawer--with-primary:not(.studio-parameters-drawer--open) .studio-parameters__advanced{ display: none;}
|
|
73
|
+
.studio-parameters__advanced{ display: grid; gap: 10px; min-width: 0;}
|
|
45
74
|
.studio-parameters{ display: grid; gap: 12px;}
|
|
46
|
-
.studio-start--vision{ overflow-y: auto; align-items: start; padding-bottom: 32px;}
|
|
47
|
-
.studio-start--vision .studio-start__center{ gap: 24px;}
|
|
48
75
|
.studio-composer--vision{ gap: 16px;}
|
|
49
76
|
.studio-locate-input{ min-width: 0; overflow: hidden; border-radius: var(--nimi-radius-lg); background: var(--nimi-surface-card);}
|
|
50
77
|
.studio-locate-input__empty{ display: grid; justify-items: center; align-content: center; gap: 12px; min-height: 156px; padding: 24px;}
|
|
@@ -52,7 +79,6 @@
|
|
|
52
79
|
.studio-locate-input__preview{ display: block; width: 100%; height: 220px; object-fit: contain; image-orientation: from-image;}
|
|
53
80
|
.studio-locate-input__file{ display: flex; align-items: center; gap: 8px; padding: 8px 12px;}
|
|
54
81
|
.studio-locate-input__file > span{ flex: 1; min-width: 0; overflow: hidden; color: var(--nimi-text-secondary); font-size: 13px; text-overflow: ellipsis; white-space: nowrap;}
|
|
55
|
-
.studio-locate-input__label{ color: var(--nimi-text-primary); font-size: 13px; font-weight: var(--nimi-type-label-weight);}
|
|
56
82
|
.studio-locate-parameters{ padding: 12px 0;}
|
|
57
83
|
.studio-locate-parameters p{ margin: 0; color: var(--nimi-text-secondary); font-size: 12px; line-height: 1.5;}
|
|
58
84
|
.studio-composer--vision .studio-composer__bar{ flex-wrap: wrap; justify-content: flex-end;}
|
|
@@ -98,37 +124,36 @@
|
|
|
98
124
|
.studio-parameters__file-input{ position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);}
|
|
99
125
|
.studio-parameters__file-row{ display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0;}
|
|
100
126
|
.studio-parameters__file-row > span{ min-width: 0; overflow: hidden; color: var(--nimi-text-secondary); font-size: 12px; text-overflow: ellipsis; white-space: nowrap;}
|
|
101
|
-
.studio-composer__bar{ display: flex; align-items: center; justify-content: space-between; gap:
|
|
127
|
+
.studio-composer__bar{ display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; min-width: 0; border-top: 1px solid var(--nimi-border-subtle); padding-top: 10px;}
|
|
102
128
|
.studio-composer__controls,
|
|
103
|
-
.studio-composer__actions{ display: flex; align-items: center; flex-wrap: wrap; gap:
|
|
129
|
+
.studio-composer__actions{ display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0;}
|
|
130
|
+
.studio-composer__actions{ justify-content: end; margin-inline-start: auto;}
|
|
131
|
+
.studio-composer__shortcut{ color: var(--nimi-text-secondary); font-size: 11px; white-space: nowrap;}
|
|
104
132
|
.studio-context-chip,
|
|
105
|
-
.studio-intent-chip{ display: inline-flex; align-items: center; border
|
|
106
|
-
.studio-context-chip{
|
|
133
|
+
.studio-intent-chip{ display: inline-flex; align-items: center; border-radius: var(--nimi-radius-sm); color: var(--nimi-text-secondary);}
|
|
134
|
+
.studio-context-chip{ gap: 6px; min-height: 32px; padding-inline: 8px; font-size: 12px;}
|
|
135
|
+
.studio-context-chip[aria-expanded="true"],
|
|
136
|
+
.studio-context-chip--attached{ background: var(--nimi-surface-active);}
|
|
107
137
|
.studio-context-chip svg{ color: inherit;}
|
|
108
|
-
.studio-intent-chip{
|
|
138
|
+
.studio-intent-chip{ gap: 6px; min-height: 32px; max-width: min(420px, 100%); padding-inline: 8px; background: var(--nimi-surface-panel); font-size: 12px; font-weight: var(--nimi-type-label-weight);}
|
|
109
139
|
.studio-intent-chip--static{ cursor: default; }
|
|
110
140
|
.studio-intent-chip svg{ color: inherit;}
|
|
111
141
|
.studio-intent-chip span{ min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
|
|
112
|
-
.studio-generate-action{ display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 999px; background: var(--nimi-action-primary-bg); color: var(--nimi-action-primary-text); box-shadow: 0 16px 34px color-mix(in srgb, var(--nimi-action-primary-bg) 32%, transparent); cursor: pointer;}
|
|
113
|
-
.studio-generate-action--configure{ background: var(--nimi-action-primary-bg-hover); box-shadow: 0 18px 38px color-mix(in srgb, var(--nimi-action-primary-bg) 36%, transparent);}
|
|
114
|
-
.studio-generate-action:disabled{ cursor: not-allowed; opacity: 0.5; box-shadow: none;}
|
|
115
142
|
.studio-result__plain,
|
|
116
143
|
.studio-result__hint{ margin: 0; color: var(--nimi-text-secondary); line-height: 1.55;}
|
|
117
|
-
.studio-result{ overflow: hidden; border: 1px solid var(--nimi-border-subtle); border-radius: var(--nimi-radius-
|
|
118
|
-
.studio-result__top{ display: flex; align-items:
|
|
144
|
+
.studio-result{ overflow: hidden; border: 1px solid var(--nimi-border-subtle); border-radius: var(--nimi-radius-md); background: var(--nimi-surface-card); box-shadow: none !important;}
|
|
145
|
+
.studio-result__top{ display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; border-bottom: 1px solid var(--nimi-border-subtle);}
|
|
119
146
|
.studio-result__summary{ display: grid; gap: 10px; min-width: 0;}
|
|
120
147
|
.studio-result__identity,
|
|
121
148
|
.studio-result__time,
|
|
122
149
|
.studio-result__actions{ display: flex; align-items: center; gap: 12px; min-width: 0;}
|
|
123
|
-
.studio-result__actions{
|
|
150
|
+
.studio-result__actions{ flex-wrap: wrap; gap: 4px;}
|
|
124
151
|
.studio-result__action{ display: inline-grid; place-items: center; flex: 0 0 auto; width: 30px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: var(--nimi-radius-sm); background: transparent; color: color-mix(in srgb, var(--nimi-text-secondary) 82%, var(--nimi-text-secondary)); cursor: pointer;}
|
|
125
152
|
.studio-result__action svg{ display: block; width: 16px; height: 16px; flex: none; stroke: currentColor; stroke-width: 2;}
|
|
126
153
|
.studio-result__action:hover:not(:disabled){ border-color: var(--nimi-border-subtle); background: var(--nimi-surface-hover); color: var(--nimi-text-primary);}
|
|
127
154
|
.studio-result__action:disabled{ cursor: not-allowed; opacity: 0.45;}
|
|
128
|
-
.studio-
|
|
129
|
-
.studio-
|
|
130
|
-
.studio-result__time{ color: var(--nimi-text-muted); font-size: 14px; line-height: 1.2;}
|
|
131
|
-
.studio-result__meta{ display: flex; align-items: center; gap: 18px; min-width: 0; border-bottom: 1px solid var(--nimi-border-subtle); background: color-mix(in srgb, var(--nimi-surface-panel) 82%, transparent); padding: 15px 34px;}
|
|
155
|
+
.studio-result__time{ color: var(--nimi-text-secondary); font-size: 12px; line-height: 1.2;}
|
|
156
|
+
.studio-result__meta{ display: flex; align-items: center; gap: 12px; min-width: 0; border-bottom: 1px solid var(--nimi-border-subtle); background: var(--nimi-surface-panel); padding: 8px 16px;}
|
|
132
157
|
.studio-result__stats{ display: flex; flex-wrap: wrap; gap: 18px; min-width: 0;}
|
|
133
158
|
.studio-result__metric{ display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; color: var(--nimi-text-muted);}
|
|
134
159
|
.studio-result__metric span{ color: var(--nimi-text-muted); font-size: 14px;}
|
|
@@ -142,7 +167,7 @@
|
|
|
142
167
|
.studio-intent-pill__trigger:hover{ background: color-mix(in srgb, var(--nimi-surface-panel) 92%, transparent); color: var(--nimi-text-secondary);}
|
|
143
168
|
.studio-intent-pill__trigger svg{ display: block; stroke: currentColor; transition: transform 0.16s ease;}
|
|
144
169
|
.studio-intent-pill__trigger--open svg{ transform: rotate(90deg);}
|
|
145
|
-
.studio-result__body{ display: grid; gap:
|
|
170
|
+
.studio-result__body{ display: grid; gap: 14px; padding: 18px 16px;}
|
|
146
171
|
.studio-result__text{ white-space: pre-wrap; color: var(--nimi-text-secondary); font-family: var(--nimi-font-sans); font-size: 15px; font-weight: var(--nimi-type-body-weight); line-height: 1.68; letter-spacing: 0;}
|
|
147
172
|
.studio-result__text--formatted{ display: grid; gap: 22px; white-space: normal;}
|
|
148
173
|
.studio-result__subject{ margin: 0; color: var(--nimi-text-primary); font-family: var(--nimi-font-sans); font-size: 17px; font-weight: var(--nimi-type-page-title-weight); line-height: 1.25; letter-spacing: 0;}
|
|
@@ -223,15 +248,15 @@
|
|
|
223
248
|
.studio-diag__note{ margin: 10px 0 0; color: var(--nimi-text-muted); font-size: 12px;}
|
|
224
249
|
.studio-prompt-settings,
|
|
225
250
|
.studio-history-settings{ display: grid; gap: 12px; border: 1px solid var(--nimi-border-subtle); border-radius: var(--nimi-radius-lg); padding: 14px; background: linear-gradient(180deg, var(--nimi-material-glass-thick-bg), color-mix(in srgb, var(--nimi-surface-panel) 64%, transparent)), color-mix(in srgb, var(--nimi-surface-card) 72%, transparent);}
|
|
226
|
-
.studio-history-result{ display: grid; overflow: hidden; border: 1px solid var(--nimi-border-subtle); border-radius: var(--nimi-radius-
|
|
251
|
+
.studio-history-result{ display: grid; overflow: hidden; border: 1px solid var(--nimi-border-subtle); border-radius: var(--nimi-radius-md); background: var(--nimi-surface-card);}
|
|
227
252
|
.studio-prompt-settings__context p{ margin: 0; color: var(--nimi-text-secondary);}
|
|
228
253
|
.studio-history-settings__head,
|
|
229
254
|
.studio-history-result__head,
|
|
230
255
|
.studio-history-result__line{ display: flex; align-items: center; gap: 8px;}
|
|
231
|
-
.studio-history-result__head{
|
|
232
|
-
.studio-history-result__actions{ margin-left: auto;
|
|
256
|
+
.studio-history-result__head{ justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; border-bottom: 1px solid var(--nimi-border-subtle);}
|
|
257
|
+
.studio-history-result__actions{ margin-left: auto;}
|
|
233
258
|
.studio-history-settings__head span,
|
|
234
|
-
.studio-history-result__line time{ color: var(--nimi-text-
|
|
259
|
+
.studio-history-result__line time{ color: var(--nimi-text-secondary); font-size: 12px;}
|
|
235
260
|
.studio-history-settings__head{ display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; min-width: 0;}
|
|
236
261
|
.studio-history-settings__head svg{ color: var(--nimi-text-secondary);}
|
|
237
262
|
.studio-history-settings__head strong,
|
|
@@ -246,7 +271,7 @@
|
|
|
246
271
|
.studio-history-result__line{ min-width: 0; gap: 14px;}
|
|
247
272
|
.studio-history-result__title-stack{ display: grid; gap: 7px; min-width: 0;}
|
|
248
273
|
.studio-history-result__title-stack strong{ color: var(--nimi-text-primary); font-size: 18px; font-weight: var(--nimi-type-page-title-weight); line-height: 1.15;}
|
|
249
|
-
.studio-history-result__meta{ display: flex; align-items: center; gap:
|
|
274
|
+
.studio-history-result__meta{ display: flex; align-items: center; gap: 12px; min-width: 0; border-bottom: 1px solid var(--nimi-border-subtle); background: var(--nimi-surface-panel); padding: 8px 16px;}
|
|
250
275
|
.studio-history-result__tags{ display: flex; flex-wrap: wrap; gap: 18px; min-width: 0;}
|
|
251
276
|
.studio-history-result__tags span{ display: inline-flex; align-items: center; gap: 6px; color: var(--nimi-text-muted); font-size: 14px; line-height: 1.2;}
|
|
252
277
|
.studio-history-result__tags span:first-child{ min-height: 30px; border-radius: 999px; background: var(--nimi-status-success-soft-bg); padding: 0 12px; color: var(--nimi-status-success); font-weight: var(--nimi-type-page-title-weight);}
|
|
@@ -255,20 +280,21 @@
|
|
|
255
280
|
.studio-history-result__tags span.studio-history-result__tag--neutral{ background: var(--nimi-surface-active); color: var(--nimi-text-muted);}
|
|
256
281
|
.studio-history-result__intent{ display: inline-flex; align-items: center; gap: 10px; min-width: 0; margin-left: auto;}
|
|
257
282
|
.studio-history-result__intent > span{ color: var(--nimi-text-muted); font-size: 12px; font-weight: var(--nimi-type-page-title-weight); letter-spacing: 0.1em; text-transform: uppercase;}
|
|
258
|
-
.studio-history-result > .studio-history-settings{ margin: 0; border-width: 0 0 1px; border-radius: 0; background:
|
|
283
|
+
.studio-history-result > .studio-history-settings{ margin: 0; border-width: 0 0 1px; border-radius: 0; background: var(--nimi-surface-panel); padding: 14px 16px;}
|
|
259
284
|
.studio-history-result > .studio-result__text,
|
|
260
285
|
.studio-history-result > .studio-result__blocked,
|
|
261
286
|
.studio-history-result > .studio-result__rich,
|
|
262
|
-
.studio-history-result > .studio-voice-list{ margin: 0; padding:
|
|
287
|
+
.studio-history-result > .studio-voice-list{ margin: 0; padding: 18px 16px;}
|
|
263
288
|
.studio-history-shell{ position: relative; z-index: 5; width: var(--nimi-ui-module-lab-studio-side-panel-width); min-width: 0; min-height: 0; transition: width 260ms cubic-bezier(0.22, 1, 0.36, 1);}
|
|
264
289
|
.studio-history-shell::before{ content: ""; position: absolute; top: 0; bottom: 0; left: 0; z-index: 8; width: 1px; background: var(--nimi-border-subtle); pointer-events: none;}
|
|
265
290
|
.studio-history-shell--collapsed{ width: 0; pointer-events: none;}
|
|
266
291
|
.studio-history-shell--collapsed::before{ display: none;}
|
|
267
|
-
.studio-history{ box-sizing: border-box; position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr); width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: visible; border-left: 1px solid var(--nimi-border-subtle); background:
|
|
268
|
-
.studio-recent__head{ display: flex; align-items: center; justify-content: space-between; gap:
|
|
292
|
+
.studio-history{ box-sizing: border-box; position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr); width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: visible; border-left: 1px solid var(--nimi-border-subtle); background: var(--nimi-surface-card); box-shadow: none; padding: 14px 12px 16px;}
|
|
293
|
+
.studio-recent__head{ display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; margin: 0 6px 10px;}
|
|
269
294
|
.studio-history__title{ min-width: 0;}
|
|
270
|
-
.studio-history__title strong{ color:
|
|
271
|
-
.studio-history__actions{ display: flex; align-items: center; gap:
|
|
295
|
+
.studio-history__title strong{ color: var(--nimi-text-primary); font-size: 16px; line-height: 1.15; font-weight: var(--nimi-type-label-weight);}
|
|
296
|
+
.studio-history__actions{ display: flex; align-items: center; gap: 2px; min-width: max-content;}
|
|
297
|
+
.studio-history__compare-trigger{ min-height: 30px; padding-inline: 6px; font-size: 12px;}
|
|
272
298
|
.studio-history__filter-trigger{ display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: var(--nimi-radius-sm); background: transparent; color: color-mix(in srgb, var(--nimi-text-muted) 86%, transparent); cursor: pointer;}
|
|
273
299
|
.studio-history__filter-trigger:hover,
|
|
274
300
|
.studio-history__filter-trigger--active{ background: var(--nimi-material-glass-regular-bg); color: color-mix(in srgb, var(--nimi-text-muted) 96%, transparent);}
|
|
@@ -284,11 +310,11 @@
|
|
|
284
310
|
.studio-history__scope-option:hover{ background: var(--nimi-material-glass-regular-bg);}
|
|
285
311
|
.studio-history__scope-option--active{ background: var(--nimi-material-glass-regular-bg); color: var(--nimi-text-primary); font-weight: var(--nimi-type-page-title-weight);}
|
|
286
312
|
.studio-history--collapsed .studio-history__toolbar{ display: none;}
|
|
287
|
-
.studio-history__search{ display: flex; align-items: center; gap: 6px; margin: 0
|
|
313
|
+
.studio-history__search{ display: flex; align-items: center; gap: 6px; margin: 0 6px 8px; padding: 0 10px; min-height: 32px; border: 1px solid var(--nimi-border-subtle); border-radius: var(--nimi-radius-sm); background: var(--nimi-surface-panel); color: var(--nimi-text-secondary);}
|
|
314
|
+
.studio-history__search:focus-within{ outline: 2px solid var(--nimi-focus-ring-color); outline-offset: 1px;}
|
|
288
315
|
.studio-history__search input{ flex: 1; min-width: 0; border: 0; background: transparent; font-size: 12px; color: var(--nimi-text-primary); outline: none;}
|
|
289
316
|
.studio-history__search input::placeholder{ color: var(--nimi-text-muted);}
|
|
290
317
|
.studio-history--collapsed .studio-history__search{ display: none;}
|
|
291
|
-
.studio-history__scope-option--danger{ color: var(--nimi-status-danger-text, #c43d3d);}
|
|
292
318
|
.studio-recent__rows li{ position: relative;}
|
|
293
319
|
.studio-recent__row-delete{ position: absolute; top: 6px; right: 6px; z-index: 1; display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: var(--nimi-radius-sm); background: transparent; color: var(--nimi-text-muted); cursor: pointer; opacity: 0; transition: opacity 120ms ease;}
|
|
294
320
|
.studio-recent__rows li:hover .studio-recent__row-delete,
|
|
@@ -351,10 +377,19 @@
|
|
|
351
377
|
this file: Kit Dialog portals its overlay and content to <body>. */
|
|
352
378
|
@keyframes nimi-ui-module-lab-studio-spin{ to{ transform: rotate(360deg);}}
|
|
353
379
|
@keyframes nimi-ui-module-lab-studio-caret{ 50%{ opacity: 0;}}
|
|
354
|
-
@container nimi-workbench-surface (max-width: 720px){ .studio-history__toolbar, .studio-history__scope{ flex-wrap: wrap;} }
|
|
355
380
|
@media (prefers-reduced-motion: reduce){ .studio-spin, .studio-result__text--stream::after{ animation: none;} .studio-history-shell{ transition: none;}}
|
|
356
|
-
@container nimi-workbench-surface (max-width:
|
|
357
|
-
|
|
381
|
+
@container nimi-workbench-surface (max-width: 720px){
|
|
382
|
+
.studio-parameters__grid{ grid-template-columns: minmax(0, 1fr);}
|
|
383
|
+
.studio-history__scope{ flex-wrap: wrap;}
|
|
384
|
+
.studio-result__meta, .studio-history-result__meta{ flex-wrap: wrap; gap: 8px;}
|
|
385
|
+
.studio-result__intent-pill, .studio-history-result__intent{ margin-left: 0;}
|
|
386
|
+
}
|
|
387
|
+
@container nimi-workbench-surface (max-width: 540px){
|
|
388
|
+
.studio__head{ grid-template-columns: minmax(0, 1fr);}
|
|
389
|
+
.studio__head-actions{ justify-content: start;}
|
|
390
|
+
.studio__title h2{ font-size: 20px;}
|
|
391
|
+
.studio-composer__shortcut{ display: none;}
|
|
392
|
+
}
|
|
358
393
|
|
|
359
394
|
}
|
|
360
395
|
|
|
@@ -5,6 +5,7 @@ import { studioResultAssetPaths, studioWorldInputSource } from './managed-result
|
|
|
5
5
|
|
|
6
6
|
import type { AIStudioHistoryPanelPreferences } from './workspace.js';
|
|
7
7
|
import type { StudioRunHistory, StudioRunHistoryRecord } from './history.js';
|
|
8
|
+
import type { StudioJsonValue } from './runtime-types.js';
|
|
8
9
|
|
|
9
10
|
// Existing records may truthfully carry a previously truncated input preview.
|
|
10
11
|
const STORED_INPUT_PREVIEW_MAX_BYTES = 16 * 1024;
|
|
@@ -80,7 +81,7 @@ function validTimestamp(value: unknown, path: string): void {
|
|
|
80
81
|
if (Number.isNaN(new Date(requiredString(value, path)).valueOf())) historyError(path, 'requires a valid timestamp');
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
function validateHistoryJson(value: unknown, path: string, depth = 0):
|
|
84
|
+
export function validateHistoryJson(value: unknown, path: string, depth = 0): asserts value is StudioJsonValue {
|
|
84
85
|
if (value === null || typeof value === 'string' || typeof value === 'boolean') return;
|
|
85
86
|
if (typeof value === 'number' && Number.isFinite(value)) return;
|
|
86
87
|
if (depth > 32) historyError(path, 'exceeds the JSON depth bound');
|
|
@@ -270,6 +271,24 @@ export function validateStudioHistoryResult(value: unknown, path: string): void
|
|
|
270
271
|
historyError(`${path}.sample`, 'requires finite numbers');
|
|
271
272
|
}
|
|
272
273
|
optionalNonNegativeNumber(value.totalTokens, `${path}.totalTokens`);
|
|
274
|
+
if (value.retrieval !== undefined) {
|
|
275
|
+
const retrieval = value.retrieval;
|
|
276
|
+
if (!isJsonObject(retrieval) || !requiredString(retrieval.query, `${path}.retrieval.query`).trim()
|
|
277
|
+
|| !requiredString(value.spaceId, `${path}.spaceId`).trim()
|
|
278
|
+
|| !Array.isArray(retrieval.matches) || !retrieval.matches.length || retrieval.matches.length !== value.vectorCount) historyError(path, 'requires a complete retrieval ranking');
|
|
279
|
+
const seen = new Set<number>();
|
|
280
|
+
let previous = Infinity;
|
|
281
|
+
for (const match of retrieval.matches) {
|
|
282
|
+
if (!isJsonObject(match)) historyError(path, 'requires retrieval match objects');
|
|
283
|
+
nonNegativeSafeInteger(match.inputIndex, `${path}.retrieval.inputIndex`);
|
|
284
|
+
const index = match.inputIndex as number;
|
|
285
|
+
if (index >= (value.vectorCount as number) || seen.has(index) || typeof match.score !== 'number'
|
|
286
|
+
|| !Number.isFinite(match.score) || match.score < -1 || match.score > 1 || match.score > previous
|
|
287
|
+
|| Array.from(requiredString(match.excerpt, `${path}.retrieval.excerpt`)).length > 300) historyError(path, 'has invalid retrieval order or score');
|
|
288
|
+
seen.add(index);
|
|
289
|
+
previous = match.score;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
273
292
|
return;
|
|
274
293
|
}
|
|
275
294
|
if (kind === 'text-annotation') {
|
|
@@ -284,7 +303,7 @@ export function validateStudioHistoryResult(value: unknown, path: string): void
|
|
|
284
303
|
return;
|
|
285
304
|
}
|
|
286
305
|
if (kind === 'text-exchange') {
|
|
287
|
-
if (value.scenario !== 'tool-call' && value.scenario !== 'structured-output') historyError(`${path}.scenario`, 'is invalid');
|
|
306
|
+
if (value.scenario !== 'tool-call' && value.scenario !== 'structured-output' && value.scenario !== 'json-object') historyError(`${path}.scenario`, 'is invalid');
|
|
288
307
|
if (!Array.isArray(value.steps) || value.steps.length === 0 || value.steps.length > 16) historyError(`${path}.steps`, 'requires 1 to 16 steps');
|
|
289
308
|
value.steps.forEach((step, index) => {
|
|
290
309
|
const stepPath = `${path}.steps[${index}]`;
|
|
@@ -306,6 +325,12 @@ export function validateStudioHistoryResult(value: unknown, path: string): void
|
|
|
306
325
|
return;
|
|
307
326
|
}
|
|
308
327
|
if (kind === 'session') {
|
|
328
|
+
if (value.closure !== undefined) {
|
|
329
|
+
if (value.capabilityContract !== 'realtime.interact' || !isJsonObject(value.closure) || Object.keys(value.closure).some(key => !['localResourcesReleased','providerSessionClosed'].includes(key)) || typeof value.closure.localResourcesReleased !== 'boolean' || typeof value.closure.providerSessionClosed !== 'boolean') historyError(`${path}.closure`, 'requires independent closure observations');
|
|
330
|
+
}
|
|
331
|
+
if (value.audioUsage !== undefined) {
|
|
332
|
+
if (value.capabilityContract !== 'realtime.interact' || !isJsonObject(value.audioUsage) || Object.keys(value.audioUsage).some(key => !['audioSeconds','final'].includes(key)) || typeof value.audioUsage.audioSeconds !== 'number' || !Number.isFinite(value.audioUsage.audioSeconds) || value.audioUsage.audioSeconds < 0 || value.audioUsage.audioSeconds > 86400 || typeof value.audioUsage.final !== 'boolean') historyError(`${path}.audioUsage`, 'requires bounded reported audio seconds and finality');
|
|
333
|
+
}
|
|
309
334
|
requiredString(value.capabilityContract, `${path}.capabilityContract`);
|
|
310
335
|
validTimestamp(value.startedAt, `${path}.startedAt`);
|
|
311
336
|
validTimestamp(value.endedAt, `${path}.endedAt`);
|
|
@@ -519,6 +544,11 @@ export function validateRunConfig(value: unknown, path: string): void {
|
|
|
519
544
|
requiredString(target.capabilityId, `${path}.target.capabilityId`);
|
|
520
545
|
if (target.capabilityContract !== null) requiredString(target.capabilityContract, `${path}.target.capabilityContract`);
|
|
521
546
|
for (const field of ['section', 'status', 'source', 'intentLabel', 'detail'] as const) requiredString(target[field], `${path}.target.${field}`);
|
|
547
|
+
optionalString(target.targetLabel, `${path}.target.targetLabel`);
|
|
548
|
+
optionalString(target.targetRef, `${path}.target.targetRef`);
|
|
549
|
+
if (target.configuredDefaults !== undefined && !isJsonObject(target.configuredDefaults)) {
|
|
550
|
+
historyError(`${path}.target.configuredDefaults`, 'requires an object');
|
|
551
|
+
}
|
|
522
552
|
if (!isJsonObject(target.params)) historyError(`${path}.target.params`, 'requires an object');
|
|
523
553
|
if (!Array.isArray(target.paramsSummary) || target.paramsSummary.some((entry) => typeof entry !== 'string')) historyError(`${path}.target.paramsSummary`, 'requires strings');
|
|
524
554
|
if (target.profileOrigin !== null) historyError(`${path}.target.profileOrigin`, 'requires null');
|
|
@@ -570,6 +600,11 @@ export function parseStudioRunHistory(value: unknown): StudioRunHistory {
|
|
|
570
600
|
return history;
|
|
571
601
|
}
|
|
572
602
|
|
|
603
|
+
export function parseStudioRunHistoryRecord(value: unknown): StudioRunHistoryRecord {
|
|
604
|
+
if (!isJsonObject(value) || typeof value.capabilityId !== 'string') throw new Error('AI Studio history record requires a capability.');
|
|
605
|
+
return parseStudioRunHistory({ [value.capabilityId]: [value] })[value.capabilityId]![0]!;
|
|
606
|
+
}
|
|
607
|
+
|
|
573
608
|
export function flattenStudioHistoryRecords(history: StudioRunHistory): StudioRunHistoryRecord[] {
|
|
574
609
|
return Object.values(history).flatMap((records) => records);
|
|
575
610
|
}
|
|
@@ -577,19 +612,18 @@ export function flattenStudioHistoryRecords(history: StudioRunHistory): StudioRu
|
|
|
577
612
|
export function studioHistoryFromRecords(records: readonly StudioRunHistoryRecord[]): StudioRunHistory {
|
|
578
613
|
const history: StudioRunHistory = {};
|
|
579
614
|
for (const record of records) {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
});
|
|
615
|
+
if (!Object.hasOwn(history, record.capabilityId)) {
|
|
616
|
+
Object.defineProperty(history, record.capabilityId, {
|
|
617
|
+
value: [], enumerable: true, configurable: true, writable: true,
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
history[record.capabilityId]!.push(record);
|
|
587
621
|
}
|
|
588
622
|
return history;
|
|
589
623
|
}
|
|
590
624
|
|
|
591
|
-
// Saving a run never removes or shrinks another run. Storage
|
|
592
|
-
// records
|
|
625
|
+
// Saving a run never removes or shrinks another run. Storage publishes complete
|
|
626
|
+
// records independently; only an explicit user action removes history.
|
|
593
627
|
export function appendStudioRunHistoryRecord(history: StudioRunHistory, record: StudioRunHistoryRecord): StudioRunHistory {
|
|
594
628
|
return studioHistoryFromRecords([record, ...flattenStudioHistoryRecords(history).filter((existing) => existing.id !== record.id)]
|
|
595
629
|
.sort((left, right) => right.createdAt.localeCompare(left.createdAt)));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StudioAudioSeparation, StudioFaceSwap, StudioJsonValue, StudioMusicGeneration, StudioMusicTranscription, StudioSessionSummary, StudioTextDecisionAnswer, StudioTextExchangeStep, StudioVoiceConversion } from './runtime-types.js';
|
|
1
|
+
import type { StudioEmbeddingRetrieval, StudioAudioSeparation, StudioFaceSwap, StudioJsonValue, StudioMusicGeneration, StudioMusicTranscription, StudioSessionSummary, StudioTextDecisionAnswer, StudioTextExchangeStep, StudioVoiceConversion } from './runtime-types.js';
|
|
2
2
|
import { isJsonObject } from '@nimiplatform/sdk/types';
|
|
3
3
|
import { studioResultAssetReferences } from './managed-result-references.js';
|
|
4
4
|
import type { NimiLocalAppSpeechTranscript, NimiLocalAppVisionLocateResult } from '@nimiplatform/sdk/app';
|
|
@@ -18,6 +18,9 @@ export type StudioRunTargetSnapshot = {
|
|
|
18
18
|
readonly status: StudioRunTargetStatus;
|
|
19
19
|
readonly source: StudioRunTargetSource;
|
|
20
20
|
readonly intentLabel: string;
|
|
21
|
+
readonly targetLabel?: string;
|
|
22
|
+
readonly targetRef?: string;
|
|
23
|
+
readonly configuredDefaults?: Readonly<Record<string, unknown>>;
|
|
21
24
|
readonly detail: string;
|
|
22
25
|
readonly params: Readonly<Record<string, unknown>>;
|
|
23
26
|
readonly paramsSummary: readonly string[];
|
|
@@ -72,6 +75,7 @@ export type StudioRunHistoryResultSnapshot =
|
|
|
72
75
|
| {
|
|
73
76
|
ok: true;
|
|
74
77
|
kind: 'embedding';
|
|
78
|
+
retrieval?: StudioEmbeddingRetrieval;
|
|
75
79
|
summary: string;
|
|
76
80
|
vectorCount: number;
|
|
77
81
|
dimensions: number;
|
|
@@ -149,7 +153,7 @@ export type StudioRunHistoryResultSnapshot =
|
|
|
149
153
|
ok: true;
|
|
150
154
|
kind: 'text-exchange';
|
|
151
155
|
summary: string;
|
|
152
|
-
scenario: 'tool-call' | 'structured-output';
|
|
156
|
+
scenario: 'tool-call' | 'structured-output' | 'json-object';
|
|
153
157
|
steps: StudioTextExchangeStep[];
|
|
154
158
|
text: string;
|
|
155
159
|
structured?: StudioJsonValue;
|
|
@@ -590,6 +594,7 @@ export function createStudioRunHistoryResultSnapshot(result: StudioCapabilityRun
|
|
|
590
594
|
dimensions: output.dimensions,
|
|
591
595
|
...(output.spaceId ? { spaceId: output.spaceId } : {}),
|
|
592
596
|
sample: output.sample,
|
|
597
|
+
...(output.retrieval ? { retrieval: structuredClone(output.retrieval) } : {}),
|
|
593
598
|
totalTokens: output.totalTokens,
|
|
594
599
|
...trace,
|
|
595
600
|
};
|
|
@@ -641,6 +646,8 @@ export function createStudioRunHistoryResultSnapshot(result: StudioCapabilityRun
|
|
|
641
646
|
endedAt: output.endedAt,
|
|
642
647
|
ending: output.ending,
|
|
643
648
|
terminalReason: output.terminalReason,
|
|
649
|
+
...(output.audioUsage ? { audioUsage: { ...output.audioUsage } } : {}),
|
|
650
|
+
...(output.closure ? { closure: { ...output.closure } } : {}),
|
|
644
651
|
observed: { ...output.observed },
|
|
645
652
|
...trace,
|
|
646
653
|
};
|
|
@@ -769,6 +776,7 @@ export function restoreStudioCapabilityRunResult(
|
|
|
769
776
|
dimensions: snapshot.dimensions,
|
|
770
777
|
...(snapshot.spaceId ? { spaceId: snapshot.spaceId } : {}),
|
|
771
778
|
sample: snapshot.sample,
|
|
779
|
+
...(snapshot.retrieval ? { retrieval: structuredClone(snapshot.retrieval) } : {}),
|
|
772
780
|
totalTokens: snapshot.totalTokens,
|
|
773
781
|
},
|
|
774
782
|
};
|
|
@@ -815,6 +823,8 @@ export function restoreStudioCapabilityRunResult(
|
|
|
815
823
|
endedAt: snapshot.endedAt,
|
|
816
824
|
ending: snapshot.ending,
|
|
817
825
|
terminalReason: snapshot.terminalReason,
|
|
826
|
+
...(snapshot.audioUsage ? { audioUsage: { ...snapshot.audioUsage } } : {}),
|
|
827
|
+
...(snapshot.closure ? { closure: { ...snapshot.closure } } : {}),
|
|
818
828
|
observed: { ...snapshot.observed },
|
|
819
829
|
},
|
|
820
830
|
};
|
|
@@ -978,19 +988,19 @@ function hasRunConfigParam(value: unknown): boolean {
|
|
|
978
988
|
return Boolean(value);
|
|
979
989
|
}
|
|
980
990
|
|
|
981
|
-
function runConfigParamDefinitions(runConfig: StudioRunConfigSnapshot): ReadonlyArray<{ key: string; label: string; group: string }> {
|
|
982
|
-
|
|
983
|
-
return TEXT_REQUEST_PARAM_ORDER;
|
|
984
|
-
}
|
|
985
|
-
return Object.keys(runConfig.target.params)
|
|
991
|
+
function runConfigParamDefinitions(runConfig: StudioRunConfigSnapshot, params: Readonly<Record<string, unknown>>): ReadonlyArray<{ key: string; label: string; group: string }> {
|
|
992
|
+
const definitions = Object.keys(params)
|
|
986
993
|
.filter((key) => !HIDDEN_REQUEST_PARAM_KEYS.includes(key as (typeof HIDDEN_REQUEST_PARAM_KEYS)[number]))
|
|
987
994
|
.map((key) => ({ key, label: key, group: 'Request parameters' }));
|
|
995
|
+
if (runConfig.target.capabilityId === 'text.generate' || runConfig.target.capabilityId === 'chat.stream') {
|
|
996
|
+
return [...TEXT_REQUEST_PARAM_ORDER, ...definitions.filter(item => !TEXT_REQUEST_PARAM_ORDER.some(known => known.key === item.key))];
|
|
997
|
+
}
|
|
998
|
+
return definitions;
|
|
988
999
|
}
|
|
989
1000
|
|
|
990
|
-
export function getStudioRunConfigParamRows(runConfig: StudioRunConfigSnapshot): StudioRunConfigParamRow[] {
|
|
991
|
-
const params = runConfig.target.params;
|
|
1001
|
+
export function getStudioRunConfigParamRows(runConfig: StudioRunConfigSnapshot, params = runConfig.target.params): StudioRunConfigParamRow[] {
|
|
992
1002
|
if (!isJsonObject(params)) return [];
|
|
993
|
-
return runConfigParamDefinitions(runConfig).flatMap((definition) => {
|
|
1003
|
+
return runConfigParamDefinitions(runConfig, params).flatMap((definition) => {
|
|
994
1004
|
const value = params[definition.key];
|
|
995
1005
|
if (!hasRunConfigParam(value)) return [];
|
|
996
1006
|
const formatted = formatStudioRunConfigValue(value);
|
|
@@ -1007,7 +1017,7 @@ export function getStudioRunConfigParamRows(runConfig: StudioRunConfigSnapshot):
|
|
|
1007
1017
|
export function getStudioRunIntentLabel(record: StudioRunHistoryRecord): string {
|
|
1008
1018
|
const label = record.runConfig?.target.intentLabel?.trim();
|
|
1009
1019
|
if (label) return label;
|
|
1010
|
-
return
|
|
1020
|
+
return 'Unknown';
|
|
1011
1021
|
}
|
|
1012
1022
|
|
|
1013
1023
|
export function getStudioRunIntentSource(record: StudioRunHistoryRecord): StudioRunIntentSource {
|
|
@@ -1076,6 +1086,7 @@ export function getStudioRunHistoryExportText(record: StudioRunHistoryRecord): s
|
|
|
1076
1086
|
if (!snapshot.ok) return snapshot.message;
|
|
1077
1087
|
if (snapshot.kind === 'text' || snapshot.kind === 'transcript') return snapshot.body;
|
|
1078
1088
|
if (snapshot.kind === 'text-exchange') return snapshot.text;
|
|
1089
|
+
if (snapshot.kind === 'embedding' && snapshot.retrieval) return JSON.stringify({ spaceId: snapshot.spaceId, dimensions: snapshot.dimensions, retrieval: snapshot.retrieval }, null, 2);
|
|
1079
1090
|
if (snapshot.kind === 'speaker-embedding') return JSON.stringify({ jobId: snapshot.jobId, spaceId: snapshot.spaceId, vector: snapshot.vector }, null, 2);
|
|
1080
1091
|
if (snapshot.kind === 'text-decision' && snapshot.answers) return JSON.stringify({ answers: snapshot.answers }, null, 2);
|
|
1081
1092
|
return snapshot.summary;
|
|
@@ -14,11 +14,12 @@ export type StudioHostCommandResult<TValue extends object = Record<string, never
|
|
|
14
14
|
|
|
15
15
|
export type StudioTextExportResult =
|
|
16
16
|
| { readonly ok: true; readonly value: {
|
|
17
|
+
readonly destination: 'runtime-asset';
|
|
17
18
|
readonly filename: string;
|
|
18
19
|
readonly artifactPath: string;
|
|
19
20
|
readonly byteSize: number;
|
|
20
21
|
readonly revealed: boolean;
|
|
21
|
-
} }
|
|
22
|
+
} | { readonly destination: 'browser-download'; readonly filename: string; readonly byteSize: number } }
|
|
22
23
|
| { readonly ok: false; readonly error?: unknown };
|
|
23
24
|
|
|
24
25
|
export type AIStudioHostPort = {
|
|
@@ -30,7 +31,8 @@ export type AIStudioHostPort = {
|
|
|
30
31
|
};
|
|
31
32
|
readonly app: {
|
|
32
33
|
readonly projection: {
|
|
33
|
-
readonly
|
|
34
|
+
readonly assetExportAction: () => 'reveal' | 'download';
|
|
35
|
+
readonly promptDraft: (key: StudioPromptDraftKey, enabled: boolean) => Promise<{ readonly prompt: string | null }>;
|
|
34
36
|
readonly projectRunTarget: (input: {
|
|
35
37
|
readonly capability: StudioCapabilityDescriptor;
|
|
36
38
|
readonly runtime: import('./runtime-types.js').StudioRuntimeInspection | null;
|
|
@@ -47,6 +49,10 @@ export type AIStudioHostPort = {
|
|
|
47
49
|
readonly savePromptDraft: (key: StudioPromptDraftKey, prompt: string, enabled: boolean) => Promise<unknown>;
|
|
48
50
|
readonly copyText: (text: string) => Promise<StudioHostCommandResult<{ readonly copied: boolean }>>;
|
|
49
51
|
readonly exportText: (input: { readonly filename: string; readonly body: string }) => Promise<StudioTextExportResult>;
|
|
52
|
+
readonly exportAsset: (relativePath: string) => Promise<void>;
|
|
53
|
+
readonly openAssetMediaUrl: (relativePath: string, signal?: AbortSignal) => Promise<{
|
|
54
|
+
readonly url: string; readonly revoke: () => Promise<void>;
|
|
55
|
+
}>;
|
|
50
56
|
};
|
|
51
57
|
};
|
|
52
58
|
readonly sdk: {
|
|
@@ -65,13 +71,12 @@ export type AIStudioHostPort = {
|
|
|
65
71
|
readonly sizeBytes: number;
|
|
66
72
|
readonly mimeType: NimiLocalAppArtifactUploadMime;
|
|
67
73
|
}>;
|
|
68
|
-
readonly assets: NimiLocalAppClient['storage']['assets']
|
|
74
|
+
readonly assets: Omit<NimiLocalAppClient['storage']['assets'], 'reveal'>;
|
|
69
75
|
readonly storage: Pick<NimiLocalAppClient['storage'], 'readJson' | 'writeJson'>;
|
|
70
76
|
readonly aiConfig: {
|
|
71
77
|
readonly getSnapshot: () => Promise<NimiAIConfigSnapshot>;
|
|
72
78
|
readonly get: () => Promise<NimiPortableAppAIConfig | null>;
|
|
73
79
|
};
|
|
74
|
-
readonly revealLocalAppAsset: (relativePath: string) => Promise<{ readonly revealed: true }>;
|
|
75
80
|
};
|
|
76
81
|
};
|
|
77
82
|
|
|
@@ -65,6 +65,7 @@ export {
|
|
|
65
65
|
createStudioRunTargetSummary,
|
|
66
66
|
} from './run-target.js';
|
|
67
67
|
export {
|
|
68
|
+
parseStudioRunHistoryRecord,
|
|
68
69
|
DEFAULT_AI_STUDIO_HISTORY_PANEL_PREFERENCES,
|
|
69
70
|
appendStudioRunHistoryRecord,
|
|
70
71
|
cleanupStudioHistoryArtifacts,
|
|
@@ -185,6 +186,7 @@ export {
|
|
|
185
186
|
type StudioRuntimeRunnerSet,
|
|
186
187
|
} from './runtime.js';
|
|
187
188
|
export {
|
|
189
|
+
createStudioPromptDraftRepository,
|
|
188
190
|
STUDIO_PROMPT_DRAFTS_SCHEMA_VERSION,
|
|
189
191
|
createEmptyStudioPromptDraftStore,
|
|
190
192
|
parseStudioPromptDraftStore,
|
|
@@ -3,9 +3,15 @@ import { StudioHistoryResultContext, StudioHistoryPanelContext } from './context
|
|
|
3
3
|
import { Button } from '@nimiplatform/kit/ui';
|
|
4
4
|
import { useAIStudioHost } from './host-context.js';
|
|
5
5
|
import type { StudioCapabilityRunResult } from './runtime-types.js';
|
|
6
|
+
import type { StudioRunHistoryRecord } from './history.js';
|
|
6
7
|
import { forgetStudioJobRecovery, readStudioJobRecovery, type StudioJobRecoveryEntry, type StudioJobRecoveryCapability } from './job-recovery.js';
|
|
7
8
|
|
|
8
|
-
export function StudioJobRecoveryPanel({ disabled, capability = 'music.generate'
|
|
9
|
+
export function StudioJobRecoveryPanel({ disabled, capability = 'music.generate', history, onSelectHistoryRun }: {
|
|
10
|
+
readonly disabled: boolean;
|
|
11
|
+
readonly capability?: StudioJobRecoveryCapability;
|
|
12
|
+
readonly history?: readonly StudioRunHistoryRecord[];
|
|
13
|
+
readonly onSelectHistoryRun?: (record: StudioRunHistoryRecord) => void;
|
|
14
|
+
}) {
|
|
9
15
|
const host = useAIStudioHost();
|
|
10
16
|
const { translate: t } = host;
|
|
11
17
|
const commitResult = useContext(StudioHistoryResultContext);
|
|
@@ -58,7 +64,8 @@ export function StudioJobRecoveryPanel({ disabled, capability = 'music.generate'
|
|
|
58
64
|
if (next.ok) {
|
|
59
65
|
controller.signal.throwIfAborted();
|
|
60
66
|
if (!commitResult) throw new Error(t('Music.historyOwnerUnavailable'));
|
|
61
|
-
await commitResult(next, entry.prompt ?? '', entry.runConfig);
|
|
67
|
+
const record = await commitResult(next, entry.prompt ?? '', entry.runConfig);
|
|
68
|
+
if (!view.signal.aborted) onSelectHistoryRun?.(record);
|
|
62
69
|
}
|
|
63
70
|
if (view.signal.aborted) return;
|
|
64
71
|
setResult(next);
|
|
@@ -73,19 +80,22 @@ export function StudioJobRecoveryPanel({ disabled, capability = 'music.generate'
|
|
|
73
80
|
}
|
|
74
81
|
finally { if (observation.current === view) { abort.current = null; observation.current = null; if (!view.signal.aborted) setBusy(false); } }
|
|
75
82
|
}
|
|
76
|
-
|
|
83
|
+
const visibleEntries = entries.filter((entry) => !entry.result?.ok || !history?.some((record) => (
|
|
84
|
+
record.result?.ok && 'jobId' in record.result && record.result.jobId === entry.jobId
|
|
85
|
+
)));
|
|
86
|
+
if (!visibleEntries.length && !error && !busy) return null;
|
|
77
87
|
const summaryState = busy ? t('Music.recovering')
|
|
78
88
|
: error || (result && !result.ok) ? t('Music.recoveryNeedsAttention')
|
|
79
89
|
: result?.ok ? t('Music.recovered') : '';
|
|
80
90
|
return <details ref={panel} className="studio-recovery" aria-label={t('Music.recoveryTitle')}>
|
|
81
91
|
<summary>
|
|
82
|
-
{t('Music.recoveryTitle')} <span>({
|
|
92
|
+
{t('Music.recoveryTitle')} <span>({visibleEntries.length})</span>
|
|
83
93
|
{summaryState ? <span className="studio-recovery__state" role="status" title={summaryState}>{summaryState}</span> : null}
|
|
84
94
|
</summary>
|
|
85
95
|
<div className="studio-recovery__body">
|
|
86
96
|
<p className="text-sm opacity-70">{t('Music.recoveryHint')}</p>
|
|
87
97
|
<div className="max-h-48 space-y-2 overflow-y-auto">
|
|
88
|
-
{[...
|
|
98
|
+
{[...visibleEntries].reverse().map((entry) => <div key={entry.clientSubmissionId} className="flex flex-wrap items-center gap-2">
|
|
89
99
|
<time dateTime={entry.createdAt}>{new Date(entry.createdAt).toLocaleString(host.locale)}</time>
|
|
90
100
|
<Button disabled={disabled || busy} onClick={() => void recover(entry)}>{t(entry.result ? 'Music.openSaved' : 'Music.recover')}</Button>
|
|
91
101
|
<Button disabled={disabled || busy} onClick={() => void forgetStudioJobRecovery(host.sdk.storage, entry.clientSubmissionId, capability).then(() => {
|