@asterism-app/sdk 0.0.0-stage → 0.47.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 (90) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +20 -2
  3. package/docs/data-and-lifecycle.md +77 -0
  4. package/docs/getting-started.md +37 -0
  5. package/docs/manual.md +34 -0
  6. package/docs/minimal-plugin.md +33 -0
  7. package/docs/project-structure.md +27 -0
  8. package/docs/resources-and-tools.md +29 -0
  9. package/docs/views-and-settings.md +35 -0
  10. package/examples/author.ts +158 -0
  11. package/examples/consume-usage.ts +29 -0
  12. package/examples/content-author.ts +29 -0
  13. package/examples/content-contract.ts +10 -0
  14. package/examples/content-renderer.ts +26 -0
  15. package/examples/counter/docs/usage.md +9 -0
  16. package/examples/counter/package.json +27 -0
  17. package/examples/counter/src/contracts.ts +31 -0
  18. package/examples/counter/src/panel.module.css +2 -0
  19. package/examples/counter/src/renderer.tsx +69 -0
  20. package/examples/counter/src/runtime.ts +43 -0
  21. package/examples/counter/src/storage.ts +4 -0
  22. package/examples/counter/src/styles.d.ts +4 -0
  23. package/examples/counter/tsconfig.json +16 -0
  24. package/examples/counter-contract.ts +18 -0
  25. package/examples/data-codecs.ts +18 -0
  26. package/examples/events.ts +37 -0
  27. package/examples/i18n.ts +18 -0
  28. package/examples/model-completion.ts +15 -0
  29. package/examples/model-input.ts +16 -0
  30. package/examples/plugin-calls.ts +22 -0
  31. package/examples/provider-usage-headers.ts +20 -0
  32. package/examples/provider-usage.ts +34 -0
  33. package/examples/renderer.ts +47 -0
  34. package/examples/session-resources.ts +29 -0
  35. package/examples/settings-contract.ts +8 -0
  36. package/examples/settings-renderer.ts +30 -0
  37. package/examples/settings-runtime.ts +11 -0
  38. package/examples/storage.ts +26 -0
  39. package/examples/tool-renderer.ts +47 -0
  40. package/examples/web-provider.ts +27 -0
  41. package/package.json +39 -4
  42. package/src/calls.ts +27 -0
  43. package/src/card.ts +7 -0
  44. package/src/channels.ts +20 -0
  45. package/src/commands.ts +28 -0
  46. package/src/config.ts +25 -0
  47. package/src/content-runtime.ts +11 -0
  48. package/src/content.ts +6 -0
  49. package/src/contracts.ts +29 -0
  50. package/src/data-encoding.ts +14 -0
  51. package/src/error-details.ts +78 -0
  52. package/src/events.ts +91 -0
  53. package/src/i18n.ts +58 -0
  54. package/src/json.ts +4 -0
  55. package/src/model-cost-estimate.ts +49 -0
  56. package/src/model-cost.ts +44 -0
  57. package/src/model-input.ts +19 -0
  58. package/src/model-media.ts +11 -0
  59. package/src/model-records.ts +56 -0
  60. package/src/model-selection.ts +34 -0
  61. package/src/models.ts +137 -0
  62. package/src/module-contract.ts +44 -0
  63. package/src/objects.ts +89 -0
  64. package/src/plugin.ts +58 -0
  65. package/src/presentation.ts +21 -0
  66. package/src/provider-usage.ts +87 -0
  67. package/src/records.ts +60 -0
  68. package/src/renderer-calls.ts +11 -0
  69. package/src/renderer-card.ts +29 -0
  70. package/src/renderer-content.ts +9 -0
  71. package/src/renderer-creation.ts +83 -0
  72. package/src/renderer-i18n.ts +49 -0
  73. package/src/renderer-island.ts +66 -0
  74. package/src/renderer-records.ts +49 -0
  75. package/src/renderer-services.ts +75 -0
  76. package/src/renderer-tools.ts +103 -0
  77. package/src/renderer-view-state.ts +33 -0
  78. package/src/renderer.ts +158 -0
  79. package/src/runtime-calls.ts +20 -0
  80. package/src/runtime-channels.ts +24 -0
  81. package/src/runtime-contracts.ts +188 -0
  82. package/src/runtime-providers.ts +60 -0
  83. package/src/runtime-resources.ts +117 -0
  84. package/src/runtime-tools.ts +31 -0
  85. package/src/runtime-web.ts +36 -0
  86. package/src/runtime.ts +44 -0
  87. package/src/tool-result.ts +45 -0
  88. package/src/tool-validation.ts +14 -0
  89. package/src/web.ts +75 -0
  90. package/src/workspace.ts +43 -0
@@ -0,0 +1,43 @@
1
+ /** Shared workbench read contracts: consumable by both backend and frontend, independent of host storage and Node. */
2
+ import type { Json } from "./json.ts";
3
+ import type { ResourceContract } from "./module-contract.ts";
4
+ import type { SessionView } from "./records.ts";
5
+ import { z } from "zod";
6
+
7
+ /** Resource rename input; identity and external location do not change with the name. */
8
+ export const resourceTitleSchema = z.string().max(160).regex(/\S/u, "The title must contain non-whitespace text.");
9
+ export interface ResourceRef { readonly sessionId: string; readonly id: string; readonly kind: string }
10
+ /** Identity and title at committed creation; the title is a result summary and does not participate in resource identity validation. */
11
+ export interface ResourceCreationResult extends ResourceRef { readonly title: string }
12
+ export interface SessionSummary { readonly id: string; readonly title: string; readonly createdAt: string }
13
+ /** Archived session summary; archivedAt is the archival time, and startup cleanup deletes the session after the cooling-off period. */
14
+ export interface ArchivedSessionSummary extends SessionSummary { readonly archivedAt: string }
15
+ /**
16
+ * Read-only session catalog shared within the same host runtime instance; each read returns current summaries.
17
+ * list contains only active sessions; archived lists sessions in the recycle bin. Session IDs absent from both have been deleted, allowing plugins to clean up their own per-session data.
18
+ */
19
+ export interface SessionDirectory { list(): readonly SessionSummary[]; archived(): readonly ArchivedSessionSummary[] }
20
+ /** Source: null means the application itself; plugin-originated sources always include plugin identity, and resource sources always belong to that plugin. Shared by records, events, and others. */
21
+ export type Source = { readonly plugin: string; readonly resource: ResourceRef | null } | null;
22
+ export interface ResourceSnapshot<S extends Json = Json> {
23
+ readonly ref: ResourceRef;
24
+ readonly title: string;
25
+ readonly data: S;
26
+ }
27
+ /** Read-only observation handle with a fixed timeline tip and session read upper bound, distinct from the full tree and workbench projections in host IPC. */
28
+ export interface SessionSnapshot extends SessionView {
29
+ readonly position: { readonly nodeId: string | null };
30
+ readonly resources: {
31
+ all(): readonly ResourceSnapshot[];
32
+ /**
33
+ * Resources directly linked to this receiver on the snapshot's timeline path, with captured titles and public data.
34
+ * Reverse and transitive links are independent. Returns an empty list if the receiver's session, identity, or kind does not match a present resource.
35
+ * Observing links does not expand a model request's captured operation scope.
36
+ */
37
+ linkedTo(receiver: ResourceRef): readonly ResourceSnapshot[];
38
+ get<S extends Json>(contract: ResourceContract<S>, id: string):
39
+ | { status: "known"; resource: ResourceSnapshot<S> }
40
+ | { status: "unknown"; resource: ResourceSnapshot; reason: "invalid_data" }
41
+ | null;
42
+ };
43
+ }