@crouter/api 0.3.387 → 0.3.388

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 (130) hide show
  1. package/dist/api/__tests__/integration/client.test.js +97 -0
  2. package/dist/api/client.d.ts +7 -0
  3. package/dist/api/client.js +40 -21
  4. package/dist/core/asset-root.d.ts +7 -0
  5. package/dist/core/asset-root.js +18 -0
  6. package/dist/core/canvas/boot-id.d.ts +6 -0
  7. package/dist/core/canvas/boot-id.js +26 -0
  8. package/dist/core/canvas/paths.d.ts +72 -0
  9. package/dist/core/canvas/paths.js +163 -0
  10. package/dist/core/canvas/pid.d.ts +391 -0
  11. package/dist/core/canvas/pid.js +948 -0
  12. package/dist/core/command-plugins/bundle.d.ts +149 -0
  13. package/dist/core/command-plugins/bundle.js +588 -0
  14. package/dist/core/command-plugins/endpoint.d.ts +24 -0
  15. package/dist/core/command-plugins/endpoint.js +51 -0
  16. package/dist/core/config.d.ts +233 -0
  17. package/dist/core/config.js +1120 -0
  18. package/dist/core/env-name.d.ts +6 -0
  19. package/dist/core/env-name.js +9 -0
  20. package/dist/core/errors.d.ts +38 -0
  21. package/dist/core/errors.js +90 -0
  22. package/dist/core/events/emit.d.ts +6 -0
  23. package/dist/core/events/emit.js +42 -0
  24. package/dist/core/events/envelope.d.ts +2 -0
  25. package/dist/core/events/envelope.js +84 -0
  26. package/dist/core/events/errors.d.ts +4 -0
  27. package/dist/core/events/errors.js +69 -0
  28. package/dist/core/events/operation-id.d.ts +4 -0
  29. package/dist/core/events/operation-id.js +24 -0
  30. package/dist/core/events/serialize.d.ts +4 -0
  31. package/dist/core/events/serialize.js +199 -0
  32. package/dist/core/events/source.d.ts +16 -0
  33. package/dist/core/events/source.js +31 -0
  34. package/dist/core/events/types.d.ts +68 -0
  35. package/dist/core/events/types.js +11 -0
  36. package/dist/core/exclusive-lock.d.ts +34 -0
  37. package/dist/core/exclusive-lock.js +197 -0
  38. package/dist/core/fs-utils.d.ts +44 -0
  39. package/dist/core/fs-utils.js +208 -0
  40. package/dist/core/help.d.ts +309 -0
  41. package/dist/core/help.js +406 -0
  42. package/dist/core/human/page-catalog.d.ts +57 -0
  43. package/dist/core/human/page-catalog.js +172 -0
  44. package/dist/core/installed-plugins.d.ts +2 -0
  45. package/dist/core/installed-plugins.js +79 -0
  46. package/dist/core/io.d.ts +122 -0
  47. package/dist/core/io.js +373 -0
  48. package/dist/core/keybindings/attach-control.d.ts +49 -0
  49. package/dist/core/keybindings/attach-control.js +42 -0
  50. package/dist/core/keybindings/catalog.d.ts +18 -0
  51. package/dist/core/keybindings/catalog.js +257 -0
  52. package/dist/core/keybindings/types.d.ts +42 -0
  53. package/dist/core/keybindings/types.js +1 -0
  54. package/dist/core/layout.d.ts +26 -0
  55. package/dist/core/layout.js +94 -0
  56. package/dist/core/locked-file.d.ts +27 -0
  57. package/dist/core/locked-file.js +118 -0
  58. package/dist/core/log.d.ts +9 -0
  59. package/dist/core/log.js +89 -0
  60. package/dist/core/manifest.d.ts +5 -0
  61. package/dist/core/manifest.js +15 -0
  62. package/dist/core/plugin-env.d.ts +8 -0
  63. package/dist/core/plugin-env.js +31 -0
  64. package/dist/core/plugin-extensions.d.ts +29 -0
  65. package/dist/core/plugin-extensions.js +191 -0
  66. package/dist/core/plugin-swap-lock.d.ts +9 -0
  67. package/dist/core/plugin-swap-lock.js +31 -0
  68. package/dist/core/preview-result-path.d.ts +4 -0
  69. package/dist/core/preview-result-path.js +26 -0
  70. package/dist/core/profiles/env-store.d.ts +22 -0
  71. package/dist/core/profiles/env-store.js +163 -0
  72. package/dist/core/profiles/fuzzy-match.d.ts +19 -0
  73. package/dist/core/profiles/fuzzy-match.js +92 -0
  74. package/dist/core/profiles/manifest.d.ts +120 -0
  75. package/dist/core/profiles/manifest.js +529 -0
  76. package/dist/core/rate-limit-scope.d.ts +25 -0
  77. package/dist/core/rate-limit-scope.js +64 -0
  78. package/dist/core/render.d.ts +12 -0
  79. package/dist/core/render.js +138 -0
  80. package/dist/core/resolver.d.ts +14 -0
  81. package/dist/core/resolver.js +111 -0
  82. package/dist/core/runtime/branded-host.d.ts +25 -0
  83. package/dist/core/runtime/branded-host.js +264 -0
  84. package/dist/core/runtime/broker/daemon-ops.d.ts +65 -0
  85. package/dist/core/runtime/broker/daemon-ops.js +177 -0
  86. package/dist/core/runtime/broker/signal-stream.d.ts +30 -0
  87. package/dist/core/runtime/broker/signal-stream.js +149 -0
  88. package/dist/core/scope.d.ts +32 -0
  89. package/dist/core/scope.js +184 -0
  90. package/dist/core/scoped-state/db.d.ts +17 -0
  91. package/dist/core/scoped-state/db.js +247 -0
  92. package/dist/core/scoped-state/migrate.d.ts +8 -0
  93. package/dist/core/scoped-state/migrate.js +187 -0
  94. package/dist/core/scoped-state/paths.d.ts +9 -0
  95. package/dist/core/scoped-state/paths.js +27 -0
  96. package/dist/core/scoped-state/profiles.d.ts +27 -0
  97. package/dist/core/scoped-state/profiles.js +93 -0
  98. package/dist/core/scoped-state/providers.d.ts +24 -0
  99. package/dist/core/scoped-state/providers.js +19 -0
  100. package/dist/core/scoped-state/schema.d.ts +6 -0
  101. package/dist/core/scoped-state/schema.js +43 -0
  102. package/dist/core/scoped-state/settings.d.ts +28 -0
  103. package/dist/core/scoped-state/settings.js +83 -0
  104. package/dist/core/spaces/open-beneath.d.ts +71 -0
  105. package/dist/core/spaces/open-beneath.js +581 -0
  106. package/dist/core/sqlite-statements.d.ts +4 -0
  107. package/dist/core/sqlite-statements.js +17 -0
  108. package/dist/core/subscription-state.d.ts +121 -0
  109. package/dist/core/subscription-state.js +287 -0
  110. package/dist/core/user-settings.d.ts +377 -0
  111. package/dist/core/user-settings.js +458 -0
  112. package/dist/daemon/broker-signals/bus.d.ts +30 -0
  113. package/dist/daemon/broker-signals/bus.js +87 -0
  114. package/dist/daemon/manage.d.ts +176 -0
  115. package/dist/daemon/manage.js +664 -0
  116. package/dist/daemon/pidfile.d.ts +8 -0
  117. package/dist/daemon/pidfile.js +37 -0
  118. package/dist/daemon/startup-policy.d.ts +1 -0
  119. package/dist/daemon/startup-policy.js +1 -0
  120. package/dist/native/linux.d.ts +29 -0
  121. package/dist/native/linux.js +20 -0
  122. package/dist/shared/env.d.ts +116 -0
  123. package/dist/shared/env.js +271 -0
  124. package/dist/shared/inbox-entry-body.d.ts +22 -0
  125. package/dist/shared/inbox-entry-body.js +116 -0
  126. package/dist/shared/working-activity.d.ts +9 -0
  127. package/dist/shared/working-activity.js +27 -0
  128. package/dist/types.d.ts +562 -0
  129. package/dist/types.js +186 -0
  130. package/package.json +1 -1
@@ -0,0 +1,149 @@
1
+ import { type ValidatedCommandManifest } from '../../api/command-manifest/manifest.js';
2
+ import type { KindConfig, MemoryExtensionDeclarations, PageComponentRegistration, PluginBundle, PluginManifest, Scope } from '../../types.js';
3
+ /** Who may call a capability provider's tool group (contract 3). */
4
+ export type ProviderGroupWho = 'own' | 'user' | 'allowlist' | 'any';
5
+ /** One tool group a capability provider declares in `bundle.json`. */
6
+ export interface ProviderGroupDeclaration {
7
+ group: string;
8
+ consent_line: string;
9
+ /** Price per unit, or null/absent when the group is unpriced. */
10
+ rate?: number | null;
11
+ who: ProviderGroupWho;
12
+ /** The app principals the group admits: `[]` unless `who` is `allowlist`
13
+ * (where it may also be empty). */
14
+ allowlist: string[];
15
+ }
16
+ /** The `provider` block of a capability-provider bundle emitted by the directory. */
17
+ export interface ProviderBlock {
18
+ id: string;
19
+ major: number;
20
+ groups: ProviderGroupDeclaration[];
21
+ }
22
+ export interface BundleIssue {
23
+ code: string;
24
+ path?: string;
25
+ message: string;
26
+ received: string;
27
+ expected: string;
28
+ next: string;
29
+ }
30
+ export interface ValidatedBundle {
31
+ bundleVersion: 1;
32
+ /** The plugin's integer major: `bundle.json` `version`, else `commands.json`
33
+ * `version`; absent when neither declares one (treated as 1 locally). */
34
+ version?: number;
35
+ /** The transport `bundle.json` declares, when it declares one (a bundle the
36
+ * directory emits for a capability provider always does). */
37
+ transport?: {
38
+ kind: 'http';
39
+ endpoint: string;
40
+ authEnv?: string;
41
+ };
42
+ /** The capability-provider block: present only on a provider bundle. */
43
+ provider?: ProviderBlock;
44
+ /** Kind-registry contributions declared in `bundle.json` (optional). The
45
+ * installer copies this validated block into the synthesized plugin
46
+ * manifest, where `readMergedLaunchConfig` layers it — see
47
+ * `PluginManifest.kinds`. */
48
+ kinds?: Record<string, Partial<KindConfig>>;
49
+ /** Page-component contributions declared in `bundle.json` (optional). The
50
+ * installer copies this validated block into the synthesized plugin
51
+ * manifest, where `resolvePageComponents` reads it — see
52
+ * `PluginManifest.page_components`. */
53
+ page_components?: PageComponentRegistration[];
54
+ /** Plugin-owned memory metadata declarations copied into the synthesized
55
+ * installed manifest alongside the archive's memory documents. */
56
+ memory_extensions?: MemoryExtensionDeclarations;
57
+ commands: ValidatedCommandManifest;
58
+ commandsBytes: Uint8Array;
59
+ directories: ReadonlyArray<{
60
+ path: string;
61
+ }>;
62
+ memory: ReadonlyArray<{
63
+ path: string;
64
+ bytes: Uint8Array;
65
+ }>;
66
+ hooks?: {
67
+ manifest: Uint8Array;
68
+ files: ReadonlyArray<{
69
+ path: string;
70
+ bytes: Uint8Array;
71
+ }>;
72
+ };
73
+ }
74
+ export interface PluginBundleValidation {
75
+ bundle?: ValidatedBundle;
76
+ issues: BundleIssue[];
77
+ }
78
+ /** Validate a Core-served plugin directory archive entirely in memory. */
79
+ export declare function validatePluginBundle(archive: Uint8Array, options: {
80
+ reservedCoreNames: ReadonlySet<string>;
81
+ coreCommandPaths?: ReadonlySet<string>;
82
+ extensibleCoreBranches?: ReadonlySet<string>;
83
+ }): Promise<PluginBundleValidation>;
84
+ /** An archive install's invocation transport. */
85
+ export type BundleInvocationTransport = {
86
+ kind: 'http';
87
+ endpoint: string;
88
+ authEnv?: string;
89
+ };
90
+ /** The hash recorded as a bundle package's `version`: the exact archive bytes
91
+ * unpacked at its root. Same bytes, same version — which is what lets a
92
+ * re-sent archive be recognized as the generation already installed. */
93
+ export declare function bundleVersion(raw: Uint8Array): string;
94
+ /** Whether `version` is the generation already unpacked at `root`. Both halves
95
+ * matter: the recorded version says the config agrees, and `commands.json`
96
+ * says the tree that config describes is actually on disk. A swap that died
97
+ * between the rename and the config write leaves the second false, and that is
98
+ * exactly the case a no-op must not claim. */
99
+ export declare function isInstalledGeneration(name: string, scope: Scope, root: string, version: string): boolean;
100
+ /** The ledger for a check that reached a served archive. `swapped` says whether
101
+ * that archive replaced the package on disk; the validator and the check time
102
+ * are recorded either way, because both describe the bytes now at the root. */
103
+ export declare function recordCheckedGeneration(scope: Scope, name: string, etag: string | undefined, options: {
104
+ swapped: boolean;
105
+ }): void;
106
+ export interface InstallBundleArchiveOptions<M> {
107
+ scope: Scope;
108
+ /** The scope root whose `tmp/` holds staging, `.prev` and the swap lock. */
109
+ scopeRootPath: string;
110
+ /** Where the package lives once swapped in: `<plugins>/<name>`. */
111
+ root: string;
112
+ /** The archive source recorded on the manifest. */
113
+ bundle: PluginBundle;
114
+ /** Invocation transport for an ordinary archive. A provider bundle's own
115
+ * `bundle.json` transport (the provider endpoint) replaces it: the archive
116
+ * comes from the directory, but calls go to the provider. */
117
+ transport: BundleInvocationTransport;
118
+ /** The server's validator for `raw`, recorded once the swap lands. */
119
+ etag: string | undefined;
120
+ enable: boolean;
121
+ /** `bundleVersion(raw)` when the caller already computed it. */
122
+ version?: string;
123
+ validation: {
124
+ reservedCoreNames: ReadonlySet<string>;
125
+ coreCommandPaths?: ReadonlySet<string>;
126
+ extensibleCoreBranches?: ReadonlySet<string>;
127
+ };
128
+ /** Full candidate validation of the staged tree; throws to refuse it. */
129
+ validateStaged: (staging: string, manifest: PluginManifest) => Promise<M>;
130
+ /** Builds the error an invalid archive throws. */
131
+ invalid: (summary: string, issues: readonly BundleIssue[]) => Error;
132
+ /** Checked against the validated archive before anything is written; a
133
+ * returned message refuses the archive (a provider bundle naming another id). */
134
+ accept?: (bundle: ValidatedBundle) => string | undefined;
135
+ }
136
+ export interface InstalledBundleArchive<M> {
137
+ manifest: PluginManifest;
138
+ validated: ValidatedBundle;
139
+ version: string;
140
+ root: string;
141
+ staged: M;
142
+ }
143
+ /**
144
+ * Validate `raw`, stage it beside the package root, swap it in, then record
145
+ * the config version and the state validator — in that order, never the
146
+ * reverse. A failure before the swap leaves the previous package untouched.
147
+ * The caller holds the plugin's swap lock (`bundleSwapLockPath`).
148
+ */
149
+ export declare function installBundleArchive<M>(name: string, raw: Uint8Array, options: InstallBundleArchiveOptions<M>): Promise<InstalledBundleArchive<M>>;