@asterism-app/sdk 2.2.1 → 2.4.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.
@@ -1,33 +0,0 @@
1
- # Adapt a small plugin
2
-
3
- The SDK's counter package in `examples/counter` is a complete plugin, not a specification for every plugin's structure. Its maintained source shows concrete assembly. Use it to understand ownership and then change the design to fit the capability you need.
4
-
5
- ## Follow one change through the system
6
-
7
- The counter separates a shared declaration, backend work, and a card that presents the result. Backend and frontend import the same contracts; sharing a name or copying a schema would not create the same runtime identity.
8
-
9
- An increment updates the current value and records the change together. That is a deliberate product choice: current data supports use now, while the record explains what happened. The counter does not promise that browsing history restores its value. A different resource may need a different relationship between current state and history.
10
-
11
- The card initiates work without becoming its durable owner. This separation matters when a view closes, remounts, or fails while the resource remains present. UI pending state belongs to the interaction; committed results belong to the backend.
12
-
13
- The model-facing read operation exposes an existing capability rather than inventing a second source of truth. Its registration does not itself grant access to the counter. Treat visibility, authorization, and presentation as separate choices.
14
-
15
- ## Adapt ownership before adding features
16
-
17
- Choose a distinct plugin identity for a new package. Keep shared contracts independent of executable implementations, but group a capability's code so its state transitions remain understandable together.
18
-
19
- Decide whether each new piece of state is a current value, a historical fact, a preference, or temporary interaction state. Decide who ends any new asynchronous work. A connection shared by all counters would belong to the plugin; a process meaningful only for one counter would belong to that resource.
20
-
21
- A Home entry can start a session around the counter without introducing an Agent or a first message. Keep that independence when adapting the example unless conversation is part of the new plugin's domain.
22
-
23
- ## Build the package you will load
24
-
25
- The counter's package manifest keeps source entries under `asterism.build`; the build writes the loaded artifact into `dist`. Its build script invokes `asterism-plugin-build`. Install dependencies, typecheck, and build explicitly; add the package directory to Asterism and restart. Rebuild and restart after source changes rather than expecting the application to compile them.
26
-
27
- The counter intentionally exposes its contracts as `asterism-example-counter/contracts` in both realms. Its internal relative imports and public entry share one build graph per realm. Consumers need the provider enabled and declare that package as a peer dependency; installing a declaration package alone is not enough.
28
-
29
- ## Check the adapted design
30
-
31
- Use a compatible application and public SDK for development. Type checking checks contract agreement; loading the package and exercising it checks the integration.
32
-
33
- Trace one change from the initiating interface to saved state and history. Then check invalid input, visible failure, reopening saved objects, and cleanup. These checks should test promises your resource makes, not merely confirm that the copied example still has the same controls.
@@ -1,37 +0,0 @@
1
- # Organize a plugin
2
-
3
- A plugin is a unit of installation, identity, settings, and lifetime. Internal modules group capabilities that share that ownership; they need not become separate public abstractions.
4
-
5
- ## Separate responsibilities, keep capabilities cohesive
6
-
7
- Shared contracts describe transferable data and operations. Backend implementations own work and persistence. Frontend views present state and collect input. Keep shared declarations independent of libraries that belong only to one implementation environment.
8
-
9
- A view reaches backend behavior through typed communication rather than importing its implementation. Within that boundary, keep a capability's declarations, behavior, and presentation understandable together. Compose capabilities through explicit dependencies instead of exposing internal layers merely because they exist.
10
-
11
- ## Choose a domain boundary
12
-
13
- Use a domain's public extension points when adding to its existing behavior. A plugin with its own resource can instead own that resource's behavior and presentation. Extending an Agent and implementing a new paradigm are different commitments.
14
-
15
- A paradigm may define how work starts, how requests are assembled, and how execution is presented. Sessions and host capabilities do not require a conversation card. Choose the composition that fits the workflow rather than treating the bundled paradigm as the host's mandatory object model.
16
-
17
- ## Publish only what consumers need
18
-
19
- A public package is useful when multiple plugins need the same declarations or service boundary. Publish capabilities with an intentional meaning for consumers, not a mirror of the provider's internal organization.
20
-
21
- For a small extension, public exports from the implementation package may be sufficient. A separate API library can make sense when the shared domain has its own authoring surface and should remain independent of implementation imports. Neither choice makes the library a second plugin or gives consumers access to private state.
22
-
23
- Import original public values. Shared contracts carry runtime identity as well as types, so a local copy is not a substitute for the provider's declaration. Development package versions support authoring; the enabled provider supplies the running implementation.
24
-
25
- ## Separate source inputs from delivered code
26
-
27
- The package root owns identity, release metadata, translations, and manual declarations. `asterism.build` holds source inputs, and the build writes loading metadata into `dist`. Keeping those roles separate lets a source checkout and a published package use the same loader without requiring the application to transform TypeScript.
28
-
29
- Owned public entries are listed as exact import specifiers per realm and resolve through the package's own `exports`. Compile each realm's implementation and owned public entries together so the provider uses the same declarations as its consumers. A separate authoring API package can supply types without becoming a separately activated plugin.
30
-
31
- Package dependency declarations carry the boundary. Peer dependencies name what the application or other plugins supply; imports of them stay external and resolve to the running instances. Ordinary dependencies are private: the backend loads them from the installed package with their own files and native binaries, and the browser build bundles them. Backend and renderer graphs are separate: identity is shared within a realm, not memory shared between processes or with the browser. Root documentation and translation metadata remain with the package rather than moving into executable loading metadata.
32
-
33
- ## Keep service ownership with the provider
34
-
35
- A provider owns shared initialization and cleanup. Consumers depend on the capability they use and release their own subscriptions or requests without ending services shared by others.
36
-
37
- Keep that ownership explicit when composing modules. A dependency should explain why a capability is needed, not require consumers to understand the provider's file layout or startup internals.