sh3-core 0.14.0 → 0.15.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 (63) hide show
  1. package/dist/api.d.ts +3 -1
  2. package/dist/api.js +4 -0
  3. package/dist/contributions/index.d.ts +1 -1
  4. package/dist/contributions/index.js +1 -1
  5. package/dist/contributions/registry.d.ts +7 -0
  6. package/dist/contributions/registry.js +24 -4
  7. package/dist/contributions/registry.test.js +56 -1
  8. package/dist/contributions/types.d.ts +9 -0
  9. package/dist/layout/LayoutRenderer.svelte +1 -1
  10. package/dist/layout/tree-walk.js +6 -1
  11. package/dist/layout/types.d.ts +7 -0
  12. package/dist/overlays/FloatFrame.svelte +8 -2
  13. package/dist/overlays/float.js +6 -3
  14. package/dist/overlays/float.test.js +71 -0
  15. package/dist/primitives/widgets/IconToggleGroup.svelte +4 -1
  16. package/dist/primitives/widgets/Segmented.svelte +4 -1
  17. package/dist/runtime/index.d.ts +2 -0
  18. package/dist/runtime/index.js +1 -0
  19. package/dist/runtime/runVerb.d.ts +10 -0
  20. package/dist/runtime/runVerb.js +97 -0
  21. package/dist/runtime/runVerb.test.d.ts +1 -0
  22. package/dist/runtime/runVerb.test.js +132 -0
  23. package/dist/sh3core-shard/AppInfoView.svelte +154 -0
  24. package/dist/sh3core-shard/AppInfoView.svelte.d.ts +11 -0
  25. package/dist/sh3core-shard/appActions.js +23 -5
  26. package/dist/shards/activate-contributions.test.js +31 -0
  27. package/dist/shards/activate-runtime.test.d.ts +1 -0
  28. package/dist/shards/activate-runtime.test.js +179 -0
  29. package/dist/shards/activate.svelte.js +20 -3
  30. package/dist/shards/registry.d.ts +11 -1
  31. package/dist/shards/registry.js +16 -4
  32. package/dist/shards/registry.test.js +24 -16
  33. package/dist/shards/types.d.ts +38 -1
  34. package/dist/shell-shard/ScrollbackView.svelte +40 -19
  35. package/dist/shell-shard/Terminal.svelte +55 -4
  36. package/dist/shell-shard/contract.d.ts +34 -0
  37. package/dist/shell-shard/dispatch-custom.test.js +48 -0
  38. package/dist/shell-shard/dispatch-gating.test.d.ts +1 -0
  39. package/dist/shell-shard/dispatch-gating.test.js +63 -0
  40. package/dist/shell-shard/dispatch-invoke.test.d.ts +1 -0
  41. package/dist/shell-shard/dispatch-invoke.test.js +214 -0
  42. package/dist/shell-shard/dispatch.d.ts +9 -1
  43. package/dist/shell-shard/dispatch.js +73 -2
  44. package/dist/shell-shard/output.d.ts +8 -1
  45. package/dist/shell-shard/output.js +17 -1
  46. package/dist/shell-shard/output.test.js +24 -5
  47. package/dist/shell-shard/registry-resolve.test.d.ts +1 -0
  48. package/dist/shell-shard/registry-resolve.test.js +26 -0
  49. package/dist/shell-shard/registry.d.ts +12 -1
  50. package/dist/shell-shard/registry.js +12 -1
  51. package/dist/shell-shard/shellApi.d.ts +3 -0
  52. package/dist/shell-shard/shellApi.js +142 -0
  53. package/dist/shell-shard/shellShard.svelte.d.ts +1 -7
  54. package/dist/shell-shard/shellShard.svelte.js +8 -163
  55. package/dist/shell-shard/terminal-dispatch.test.js +10 -3
  56. package/dist/shell-shard/toolbar/slots/BusySlot.svelte +35 -0
  57. package/dist/shell-shard/toolbar/slots/BusySlot.svelte.d.ts +7 -0
  58. package/dist/shell-shard/verbs/clear.js +1 -0
  59. package/dist/shell-shard/verbs/mode.js +1 -0
  60. package/dist/verbs/types.d.ts +68 -0
  61. package/dist/version.d.ts +1 -1
  62. package/dist/version.js +1 -1
  63. package/package.json +1 -1
@@ -0,0 +1,35 @@
1
+ <script lang="ts">
2
+ interface Props {
3
+ active: boolean;
4
+ label: string | null;
5
+ }
6
+ let { active, label }: Props = $props();
7
+ </script>
8
+
9
+ {#if active}
10
+ <div class="busy" role="status" aria-live="polite">
11
+ <span class="spinner" aria-hidden="true"></span>
12
+ {#if label}<span class="label">{label}</span>{/if}
13
+ </div>
14
+ {/if}
15
+
16
+ <style>
17
+ .busy {
18
+ display: inline-flex;
19
+ align-items: center;
20
+ gap: 6px;
21
+ color: var(--shell-fg-muted, #aaa);
22
+ font-size: 0.85em;
23
+ }
24
+ .spinner {
25
+ width: 12px;
26
+ height: 12px;
27
+ border: 2px solid var(--shell-fg-muted, #aaa);
28
+ border-top-color: transparent;
29
+ border-radius: 50%;
30
+ animation: busy-spin 0.8s linear infinite;
31
+ }
32
+ @keyframes busy-spin {
33
+ to { transform: rotate(360deg); }
34
+ }
35
+ </style>
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ active: boolean;
3
+ label: string | null;
4
+ }
5
+ declare const BusySlot: import("svelte").Component<Props, {}, "">;
6
+ type BusySlot = ReturnType<typeof BusySlot>;
7
+ export default BusySlot;
@@ -1,6 +1,7 @@
1
1
  export const clearVerb = {
2
2
  name: 'clear',
3
3
  summary: 'Clear the scrollback (local only — other views are unaffected).',
4
+ globalVerb: true,
4
5
  async run(ctx) {
5
6
  ctx.scrollback.clear();
6
7
  },
@@ -1,6 +1,7 @@
1
1
  export const modeVerb = {
2
2
  name: 'mode',
3
3
  summary: 'List or switch shell modes. Usage: mode | mode <id>',
4
+ globalVerb: true,
4
5
  async run(ctx, args) {
5
6
  const ts = Date.now();
6
7
  if (args.length === 0) {
@@ -86,10 +86,78 @@ export interface VerbContext {
86
86
  fs: TenantFsClient;
87
87
  /** Invoke another registered verb programmatically (used by rich-entry clicks). */
88
88
  dispatch(line: string): Promise<void>;
89
+ /**
90
+ * When the verb was invoked via `ctx.runVerb(..., { structured })`,
91
+ * this holds the structured payload the caller passed. Terminal-driven
92
+ * invocations leave it undefined and the verb falls back to `args[]`.
93
+ * See `Verb.schema.input` for the JSON Schema describing the shape.
94
+ */
95
+ structuredArgs?: unknown;
96
+ /**
97
+ * When the verb was invoked via `ctx.runVerb(..., { signal })`, this
98
+ * carries the abort signal so cooperative verbs can honor cancellation.
99
+ * Terminal-driven invocations leave it undefined.
100
+ */
101
+ signal?: AbortSignal;
102
+ }
103
+ /**
104
+ * Portable JSON Schema subset accepted by sh3-core for `Verb.schema.input`.
105
+ * Documented as the intersection of what Anthropic, OpenAI, and Gemini
106
+ * tool-call APIs accept natively. sh3-core does NOT validate that the
107
+ * actual schema stays within this subset — authors who reach for `oneOf`,
108
+ * `$ref`, or other Draft 2020-12 features do so at their own portability
109
+ * risk. The type is intentionally `unknown`-permissive on `properties`
110
+ * and `items` so authors can express object/array shapes without
111
+ * fighting the type system.
112
+ */
113
+ export interface PortableJSONSchema {
114
+ type?: 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
115
+ description?: string;
116
+ enum?: unknown[];
117
+ default?: unknown;
118
+ /** Object-shape property map (key → sub-schema). */
119
+ properties?: Record<string, PortableJSONSchema>;
120
+ /** Required property names for `type: 'object'`. */
121
+ required?: string[];
122
+ /** Item schema for `type: 'array'`. */
123
+ items?: PortableJSONSchema;
124
+ }
125
+ /**
126
+ * Optional schema attached to a verb. Today only `input` is consumed
127
+ * (by sh3-ai's tool-call dispatcher); `output` is deferred until
128
+ * sh3-editor's graph view materializes a real consumer.
129
+ */
130
+ export interface VerbSchema {
131
+ input: PortableJSONSchema;
89
132
  }
90
133
  export interface Verb {
91
134
  name: string;
92
135
  summary: string;
136
+ /**
137
+ * When true, this verb resolves in every shell mode — including bash and
138
+ * external shards' custom modes. Defaults to false: sh3-domain verbs only
139
+ * resolve when `mode.id === 'sh3'`. Reserve this flag for verbs whose
140
+ * action is mode-agnostic (e.g. `clear` clears the local scrollback,
141
+ * `mode` switches modes — both make sense everywhere).
142
+ */
143
+ globalVerb?: boolean;
144
+ /**
145
+ * When true, this verb opts in to dispatch via `ctx.runVerb(...)`. By
146
+ * setting this flag the author commits to behaving correctly outside a
147
+ * real terminal frame — in particular, treating `ctx.scrollback` as a
148
+ * sink whose entries the caller may render later, and not depending on
149
+ * UI side-effects beyond what the synthesized context provides
150
+ * (no `ctx.session.connect()`, no terminal-mode switching, etc.).
151
+ * Defaults to false; `runVerb` rejects non-programmatic verbs.
152
+ */
153
+ programmatic?: boolean;
154
+ /**
155
+ * Optional input/output schema for typed callers. When present and the
156
+ * caller dispatches with `runVerb(..., { structured })`, the structured
157
+ * payload is delivered via `ctx.structuredArgs`; the verb chooses
158
+ * whether to read it or fall back to `args[]`.
159
+ */
160
+ schema?: VerbSchema;
93
161
  run(ctx: VerbContext, args: string[]): Promise<void>;
94
162
  }
95
163
  export type Resolution = {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** Auto-generated from package.json — do not edit manually. */
2
- export declare const VERSION = "0.14.0";
2
+ export declare const VERSION = "0.15.0";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /** Auto-generated from package.json — do not edit manually. */
2
- export const VERSION = '0.14.0';
2
+ export const VERSION = '0.15.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sh3-core",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"