@vanellye/spirit-workplay 0.0.0-stage → 0.1.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 (31) hide show
  1. package/Package.swift +32 -0
  2. package/README.md +130 -2
  3. package/android/build.gradle.kts +33 -0
  4. package/android/src/main/AndroidManifest.xml +1 -0
  5. package/android/src/main/assets/ashshow.spirit.settings.json +1 -0
  6. package/android/src/main/assets/provider-registry.json +1 -0
  7. package/android/src/main/assets/standalone.spirit.settings.json +1 -0
  8. package/android/src/main/java/com/vanellye/spiritworkplay/SpiritWorkplayPlugin.kt +116 -0
  9. package/android/src/main/java/com/vanellye/spiritworkplay/SpiritWorkplayStore.kt +105 -0
  10. package/ios/Sources/SpiritWorkplay/Resources/ashshow.spirit.settings.json +1 -0
  11. package/ios/Sources/SpiritWorkplay/Resources/provider-registry.json +1 -0
  12. package/ios/Sources/SpiritWorkplay/Resources/standalone.spirit.settings.json +1 -0
  13. package/ios/Sources/SpiritWorkplay/SpiritWorkplayPlugin.swift +107 -0
  14. package/ios/Sources/SpiritWorkplay/SpiritWorkplayStore.swift +221 -0
  15. package/package.json +1 -6
  16. package/provider/meta-adapter.md +61 -0
  17. package/provider/openai-adapter.md +53 -0
  18. package/provider/provider-registry.json +1 -0
  19. package/runflow/audit-log.json +57 -0
  20. package/runflow/runflow.md +43 -0
  21. package/runflow/task-envelope.schema.json +1 -0
  22. package/runtime/agent-runtime.md +52 -0
  23. package/runtime/simulated-runtime.js +91 -0
  24. package/settings/ashshow.spirit.settings.json +1 -0
  25. package/settings/spirit-settings.schema.json +1 -0
  26. package/settings/standalone.spirit.settings.json +1 -0
  27. package/src/capacitor.ts +11 -0
  28. package/src/definitions.ts +38 -0
  29. package/src/index.d.ts +100 -0
  30. package/src/index.js +74 -0
  31. package/src/web.ts +74 -0
package/Package.swift ADDED
@@ -0,0 +1,32 @@
1
+ // swift-tools-version: 5.9
2
+ // Spirit Workplay — Swift wrapper (Capacitor 8, SPM).
3
+ // The package and product names are derived from the npm name
4
+ // @vanellye/spirit-workplay, as the Capacitor CLI requires: it strips @,
5
+ // turns / and - into _, then camel-cases each segment and capitalises
6
+ // the first letter. Keep them in sync with package.json or `cap sync ios`
7
+ // will fail to resolve the package.
8
+ import PackageDescription
9
+
10
+ let package = Package(
11
+ name: "VanellyeSpiritWorkplay",
12
+ platforms: [.iOS(.v15)],
13
+ products: [
14
+ .library(
15
+ name: "VanellyeSpiritWorkplay",
16
+ targets: ["SpiritWorkplay"]
17
+ )
18
+ ],
19
+ dependencies: [
20
+ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
21
+ ],
22
+ targets: [
23
+ .target(
24
+ name: "SpiritWorkplay",
25
+ dependencies: [
26
+ .product(name: "Capacitor", package: "capacitor-swift-pm")
27
+ ],
28
+ path: "ios/Sources/SpiritWorkplay",
29
+ resources: [.process("Resources")]
30
+ )
31
+ ]
32
+ )
package/README.md CHANGED
@@ -1,3 +1,131 @@
1
- # Temporary Holding Version
1
+ # Spirit(s) Workplay Runflow
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Home repo for the ChatGPT & Muse Spirit settings service: PAX companion,
4
+ PET execution, PIEVE work supply, WORK bridge.
5
+
6
+ Spirit Law: **Evolution without erasure. Invention without absorption.
7
+ Wisdom without domination.**
8
+
9
+ ## Rules
10
+
11
+ - Main is preserved. All R&D lands on `spirit-workplay-rnd`; nothing merges
12
+ without explicit approval.
13
+ - Simulation-first (Runflow: Discover → Specify → Implement → Verify →
14
+ Review → Release). No live provider calls, no deploys, no publishing from
15
+ this repo.
16
+ - No credentials anywhere in this repository. Provider credentials are
17
+ server-side only.
18
+ - A test pass is not deployment authorization.
19
+
20
+ ## Layout
21
+
22
+ - `index.html` — Innovation Core prototype (unified work cycle, work-round
23
+ queue, task envelope, evidence ledger).
24
+ - `provider/` — provider registry + adapter specs (M2).
25
+ - `settings/` — SpiritSettings schema + independent per-app settings (M3).
26
+ - `runtime/` — agent runtime spec + simulation implementation (M4).
27
+ - `runflow/` — Runflow integration, task-envelope schema, audit log (M5).
28
+ - `verification/` — local verification suite + report (M6).
29
+ - `release/` — release readiness checklist (M7).
30
+
31
+ ## Milestones
32
+
33
+ - M1 Source — home repo created (this repo). Complete.
34
+ - M2 Provider registry — OpenAI (ChatGPT) + Meta (Muse) behind one
35
+ interface, switching user-controlled.
36
+ - M3 Independent Spirit settings — `standalone.spirit.settings` and
37
+ `ashshow.spirit.settings`, isolated per app.
38
+ - M4 Agent runtime — model selection, streaming, cancellation, error
39
+ handling, usage tracking. Simulation-first.
40
+ - M5 Runflow integration — six stages wired to the task-envelope contract,
41
+ checkpoints, approval receipts, audit history.
42
+ - M6 Integration verification — `node verification/verify.js` runs locally.
43
+ - M7 Release readiness — checklist + draft PR. Do not merge.
44
+
45
+ ## Provider model map (Meta)
46
+
47
+ - `muse-spark-1.3` — default Spirit agent
48
+ - `muse-wonder-1.0` — complex research and engineering
49
+ - `muse-ember-1.0` — repeated bounded tasks
50
+
51
+ OpenAI routes by the alias `chatgpt-default` until a concrete model is named
52
+ in the registry with evidence.
53
+
54
+ ## npm package (Floot native plugin)
55
+
56
+ This repo is also the `@vanellye/spirit-workplay` npm package (0.1.0),
57
+ prepared for the Floot native-plugin route. Floot has no one-click
58
+ repository import — its docs say an existing codebase is rebuilt in Floot
59
+ page by page — and its mobile apps are the web app wrapped for iOS and
60
+ Android with Capacitor plugins. A native plugin for that wrapper is a
61
+ public npm package in the standard Capacitor plugin layout, which is what
62
+ this package follows:
63
+
64
+ - `package.json` — name, version, entry point, `files` list, the
65
+ `capacitor` ios/android source pointers, and the `@capacitor/core`
66
+ peer dependency (Capacitor 8).
67
+ - `src/index.js` — the Node entry. Thin re-export over the repo files:
68
+ the provider registry, the SpiritSettings schema and both per-app
69
+ settings, the simulated runtime, and the Runflow envelope schema.
70
+ - `src/definitions.ts` + `src/web.ts` + `src/capacitor.ts` — the
71
+ Capacitor plugin interface, web implementation, and registration
72
+ (plugin name `SpiritWorkplay`).
73
+ - `Package.swift` — at the package root, as the Capacitor CLI requires.
74
+ Package and product name `VanellyeSpiritWorkplay`, derived from the
75
+ npm name by the CLI's rule (strip `@`, turn `/` and `-` into `_`,
76
+ camel-case, capitalise the first letter).
77
+ - `ios/Sources/SpiritWorkplay/` — Swift wrapper (`SpiritWorkplayPlugin`,
78
+ `SpiritWorkplayStore`) plus `Resources/` copies of the three JSON data
79
+ files the store reads.
80
+ - `android/` — Kotlin wrapper (`build.gradle.kts`,
81
+ `SpiritWorkplayPlugin`, `SpiritWorkplayStore`) plus `assets/` copies
82
+ of the same three JSON data files.
83
+
84
+ Install (once published):
85
+
86
+ ```
87
+ npm install @vanellye/spirit-workplay
88
+ npx cap sync
89
+ ```
90
+
91
+ Then use it from JavaScript/TypeScript:
92
+
93
+ ```js
94
+ const spirit = require('@vanellye/spirit-workplay');
95
+ spirit.listProviders(); // OpenAI + Meta, with model aliases
96
+ spirit.loadSettings('standalone'); // or 'ashshow'
97
+ const runtime = spirit.createRuntime('standalone');
98
+ for await (const chunk of runtime.runTurn({ provider: 'meta', model: 'muse-spark-1.3', input: 'hello' })) {
99
+ process.stdout.write(chunk);
100
+ }
101
+ ```
102
+
103
+ Or from a Capacitor app, after `cap sync`:
104
+
105
+ ```ts
106
+ import { SpiritWorkplay } from '@vanellye/spirit-workplay/src/capacitor';
107
+ await SpiritWorkplay.listProviders();
108
+ await SpiritWorkplay.simulatedReply({ provider: 'meta', model: 'muse-spark-1.3', input: 'hello', app: 'standalone' });
109
+ await SpiritWorkplay.validateEnvelope({ envelope });
110
+ ```
111
+
112
+ What it exposes: `listProviders`, `getProvider`, `loadSettings`,
113
+ `createRuntime`, `SpiritRuntime`, `simulatedReply`, `usageFor`, the
114
+ registry, both settings files, the settings schema, and the envelope
115
+ schema. Everything is simulation-first — the runtime never makes a live
116
+ network call and the package contains no credentials.
117
+
118
+ Status: prep only. The package has not been published to npm and no npm
119
+ account or scope was created. Publishing needs the `@vanellye` scope to
120
+ exist on npm and the publish command from the repo root:
121
+
122
+ ```
123
+ npm publish --access public
124
+ ```
125
+
126
+ The native wrappers' bundled JSON copies are build-time copies of the
127
+ repo-root files; regenerate them whenever `provider/provider-registry.json`
128
+ or `settings/*.spirit.settings.json` change. Swift is not verified in this
129
+ environment (no swiftc); the Kotlin wrapper is compiled against stub
130
+ Capacitor classes (see the commit notes). No `.podspec` is shipped, so
131
+ CocoaPods-based apps would need one added.
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Spirit Workplay — Android library module (Capacitor 8).
3
+ * Defaults follow the Capacitor 8 plugin template: compileSdk 36,
4
+ * minSdk 24, AGP 8.13, Kotlin 2.2.20. The org.json API used by the
5
+ * store ships with the Android framework; it is not a declared
6
+ * dependency.
7
+ */
8
+ plugins {
9
+ id("com.android.library")
10
+ id("org.jetbrains.kotlin.android")
11
+ }
12
+
13
+ android {
14
+ namespace = "com.vanellye.spiritworkplay"
15
+ compileSdk = 36
16
+
17
+ defaultConfig {
18
+ minSdk = 24
19
+ }
20
+
21
+ compileOptions {
22
+ sourceCompatibility = JavaVersion.VERSION_17
23
+ targetCompatibility = JavaVersion.VERSION_17
24
+ }
25
+
26
+ kotlinOptions {
27
+ jvmTarget = "17"
28
+ }
29
+ }
30
+
31
+ dependencies {
32
+ implementation("com.getcapacitor:capacitor:8.0.0")
33
+ }
@@ -0,0 +1 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android" />
@@ -0,0 +1 @@
1
+ {"application_id":"ashshow","audit_preferences":{"receipts":true,"retain_days":30},"default_provider":"openai","identity":{"name":"AshShow Spirit","presence":"warm stage host"},"law":"Evolution without erasure. Invention without absorption. Wisdom without domination.","memory_policy":"ephemeral-session","namespace":"ashshow.spirit.settings","owner_id":"tucker","permissions":{"memory_consent":false,"provider_consent":false},"personality":{"boundaries":["never moves money","never publishes the Lab without explicit approval","never shares one workspace memory with another app"],"compassion":9,"curiosity":7,"directness":8,"reflection":7,"rituals":["opening welcome","closing gratitude"],"voice":"Host","wisdom_mode":"Story Led"},"provider_connections":[{"configured":true,"provider":"openai"},{"configured":false,"provider":"meta"}],"runflow_policy":"simulation-first","selected_model":"chatgpt-default","spirit_id":"spirit-ashshow-001","tool_allowlist":["read","simulate","publish-draft"],"updated_at":"2026-11-30T19:45:00-06:00"}
@@ -0,0 +1 @@
1
+ {"credentials":"server-side only. No credential, key, token, or secret is stored in this repository, in any file, at any time.","interface":"spirit-provider/v1","law":"Evolution without erasure. Invention without absorption. Wisdom without domination.","providers":[{"api":"OpenAI Responses API","auth":"server-side bearer credential, never in files","base_url":"https://api.openai.com/v1/responses","capabilities":["text","streaming"],"default_model_alias":"chatgpt-default","display_name":"ChatGPT","id":"openai","model_note":"No concrete OpenAI model name is asserted in this repository. The concrete model is bound server-side at runtime from the connected OpenAI account; the registry routes by the alias chatgpt-default until a model is named and recorded here with evidence.","models":[]},{"api":"Meta Model API","auth":"server-side bearer credential, never in files","base_url":"https://api.meta.ai/v1","capabilities":["text","streaming"],"default_model_alias":"muse-spark-1.3","display_name":"Muse","id":"meta","models":[{"id":"muse-spark-1.3","role":"default Spirit agent"},{"id":"muse-wonder-1.0","role":"complex research and engineering"},{"id":"muse-ember-1.0","role":"repeated bounded tasks"}]}],"registry":"spirit-provider-registry","routing":{"fallback":"none. If the selected provider is unavailable, the runtime returns an error receipt. It never falls back to the other provider on its own.","offline":"When no provider is reachable, the runtime answers from the local simulation only, labelled as simulated.","rule":"The caller selects a provider explicitly, or the app's Spirit settings select its default_provider. Provider switching is user-controlled; no provider is ever silently substituted."},"simulation":{"mode":"simulation-first","note":"All provider calls in this repository are simulated. The adapters describe the wire shape; the runtime never makes a live network call."},"status":"simulation-first","switching":"user-controlled","version":"0.1.0"}
@@ -0,0 +1 @@
1
+ {"application_id":"standalone","audit_preferences":{"receipts":true,"retain_days":90},"default_provider":"meta","identity":{"name":"Standalone Spirit","presence":"quiet companion"},"law":"Evolution without erasure. Invention without absorption. Wisdom without domination.","memory_policy":"ephemeral-session-isolated","namespace":"standalone.spirit.settings","owner_id":"tucker","permissions":{"memory_consent":false,"provider_consent":false},"personality":{"boundaries":["never moves money","never publishes or deploys without explicit approval","never substitutes providers silently"],"compassion":8,"curiosity":9,"directness":6,"reflection":9,"rituals":["breath pause before answering","deep-reflection close"],"voice":"Guide","wisdom_mode":"Inquiry Led"},"provider_connections":[{"configured":true,"provider":"meta"},{"configured":true,"provider":"openai"}],"runflow_policy":"simulation-first","selected_model":"muse-spark-1.3","spirit_id":"spirit-standalone-001","tool_allowlist":["read","simulate","verify"],"updated_at":"2026-11-30T19:45:00-06:00"}
@@ -0,0 +1,116 @@
1
+ package com.vanellye.spiritworkplay
2
+
3
+ import com.getcapacitor.JSObject
4
+ import com.getcapacitor.Plugin
5
+ import com.getcapacitor.PluginCall
6
+ import com.getcapacitor.PluginMethod
7
+ import com.getcapacitor.annotation.CapacitorPlugin
8
+ import org.json.JSONArray
9
+
10
+ /**
11
+ * Capacitor bridge for Spirit Workplay (Android).
12
+ * The name "SpiritWorkplay" must match the registerPlugin name in
13
+ * src/capacitor.ts and the jsName on iOS.
14
+ */
15
+ @CapacitorPlugin(name = "SpiritWorkplay")
16
+ class SpiritWorkplayPlugin : Plugin() {
17
+
18
+ private val store: SpiritWorkplayStore by lazy { SpiritWorkplayStore(context) }
19
+
20
+ @PluginMethod
21
+ fun listProviders(call: PluginCall) {
22
+ try {
23
+ val providers = store.listProviders()
24
+ val result = JSObject()
25
+ result.put("providers", providers)
26
+ call.resolve(result)
27
+ } catch (e: Exception) {
28
+ call.reject("failed to load provider registry: ${e.message}")
29
+ }
30
+ }
31
+
32
+ @PluginMethod
33
+ fun getSettings(call: PluginCall) {
34
+ val app = call.getString("app")
35
+ if (app == null) {
36
+ call.reject("app is required: 'standalone' or 'ashshow'")
37
+ return
38
+ }
39
+ try {
40
+ val settings = store.loadSettings(app)
41
+ val result = JSObject()
42
+ result.put("settings", settings)
43
+ call.resolve(result)
44
+ } catch (e: IllegalArgumentException) {
45
+ call.reject("unknown application: $app")
46
+ } catch (e: Exception) {
47
+ call.reject("failed to load settings: ${e.message}")
48
+ }
49
+ }
50
+
51
+ @PluginMethod
52
+ fun simulatedReply(call: PluginCall) {
53
+ val provider = call.getString("provider")
54
+ val model = call.getString("model")
55
+ val input = call.getString("input")
56
+ if (provider == null || model == null || input == null) {
57
+ call.reject("provider, model and input are required")
58
+ return
59
+ }
60
+ var voice = "Guide"
61
+ var wisdomMode = "Inquiry Led"
62
+ var ritual: String? = null
63
+ val app = call.getString("app")
64
+ if (app != null) {
65
+ try {
66
+ val settings = store.loadSettings(app)
67
+ val personality = settings.getJSONObject("personality")
68
+ voice = personality.optString("voice", "Guide")
69
+ wisdomMode = personality.optString("wisdom_mode", "Inquiry Led")
70
+ val rituals = personality.optJSONArray("rituals")
71
+ if (rituals != null && rituals.length() > 0) {
72
+ ritual = rituals.optString(0)
73
+ }
74
+ } catch (e: IllegalArgumentException) {
75
+ call.reject("unknown application: $app")
76
+ return
77
+ } catch (e: Exception) {
78
+ call.reject("failed to load settings: ${e.message}")
79
+ return
80
+ }
81
+ }
82
+ val reply = store.simulatedReply(provider, model, input, voice, wisdomMode, ritual)
83
+ val result = JSObject()
84
+ result.put("reply", reply)
85
+ call.resolve(result)
86
+ }
87
+
88
+ @PluginMethod
89
+ fun validateEnvelope(call: PluginCall) {
90
+ val envelope = call.getObject("envelope")
91
+ if (envelope == null) {
92
+ call.reject("envelope is required")
93
+ return
94
+ }
95
+ val errors = store.validateEnvelope(envelope)
96
+ val result = JSObject()
97
+ result.put("valid", errors.isEmpty())
98
+ result.put("errors", JSONArray(errors))
99
+ call.resolve(result)
100
+ }
101
+
102
+ @PluginMethod
103
+ fun runtimeInfo(call: PluginCall) {
104
+ try {
105
+ val registry = store.loadRegistry()
106
+ val result = JSObject()
107
+ result.put("interface", registry.getString("interface"))
108
+ result.put("law", registry.getString("law"))
109
+ result.put("version", "0.1.0")
110
+ result.put("simulation", "simulation-first")
111
+ call.resolve(result)
112
+ } catch (e: Exception) {
113
+ call.reject("failed to load provider registry: ${e.message}")
114
+ }
115
+ }
116
+ }
@@ -0,0 +1,105 @@
1
+ package com.vanellye.spiritworkplay
2
+
3
+ import android.content.Context
4
+ import org.json.JSONArray
5
+ import org.json.JSONObject
6
+ import java.io.IOException
7
+
8
+ /**
9
+ * Reads the bundled Spirit Workplay data files and implements the
10
+ * simulation-only surface shared with the JS entry (src/index.js).
11
+ *
12
+ * The bundled JSONs in src/main/assets/ are build-time copies of the
13
+ * repository files (provider/provider-registry.json and the two
14
+ * settings/<app>.spirit.settings.json files). Regenerate them from the
15
+ * repository files whenever those change; this store never invents data.
16
+ *
17
+ * No network calls, no credentials, no live provider access.
18
+ */
19
+ class SpiritWorkplayStore(private val context: Context) {
20
+
21
+ private fun loadJSONObject(name: String): JSONObject {
22
+ try {
23
+ context.assets.open(name).use { input ->
24
+ val text = input.bufferedReader(Charsets.UTF_8).readText()
25
+ return JSONObject(text)
26
+ }
27
+ } catch (e: IOException) {
28
+ throw IllegalStateException("missing bundled asset: $name", e)
29
+ }
30
+ }
31
+
32
+ fun loadRegistry(): JSONObject = loadJSONObject("provider-registry.json")
33
+
34
+ fun loadSettings(app: String): JSONObject {
35
+ return when (app) {
36
+ "standalone" -> loadJSONObject("standalone.spirit.settings.json")
37
+ "ashshow" -> loadJSONObject("ashshow.spirit.settings.json")
38
+ else -> throw IllegalArgumentException("unknown application: $app")
39
+ }
40
+ }
41
+
42
+ fun listProviders(): JSONArray {
43
+ val registry = loadRegistry()
44
+ return registry.getJSONArray("providers")
45
+ }
46
+
47
+ /**
48
+ * Deterministic simulated reply. [ritual] is the app's first ritual,
49
+ * or null when the app has none. Same shaping as the JS entry.
50
+ */
51
+ fun simulatedReply(
52
+ provider: String,
53
+ model: String,
54
+ input: String,
55
+ voice: String,
56
+ wisdomMode: String,
57
+ ritual: String?
58
+ ): String {
59
+ val ritualLine = if (ritual != null) "Ritual: $ritual. " else ""
60
+ return "[simulated · $provider/$model · voice $voice · $wisdomMode] ${ritualLine}Received: $input"
61
+ }
62
+
63
+ /**
64
+ * Validates an envelope against the Runflow task-envelope schema
65
+ * (runflow/task-envelope.schema.json). Returns the list of
66
+ * violations; empty means valid.
67
+ */
68
+ fun validateEnvelope(envelope: JSONObject): List<String> {
69
+ val errors = mutableListOf<String>()
70
+
71
+ val id = envelope.opt("id")
72
+ if (id !is Number || id.toDouble() % 1.0 != 0.0) {
73
+ errors.add("id must be an integer")
74
+ }
75
+
76
+ val title = envelope.optString("title", "")
77
+ if (title.isEmpty()) {
78
+ errors.add("title must be a non-empty string")
79
+ }
80
+
81
+ val owner = envelope.optString("owner", "")
82
+ if (owner !in setOf("PIEVE", "PAX", "PET", "WORK")) {
83
+ errors.add("owner must be one of PIEVE, PAX, PET, WORK")
84
+ }
85
+
86
+ val risk = envelope.opt("risk")
87
+ if (risk !is Number || risk.toDouble() % 1.0 != 0.0 ||
88
+ risk.toInt() < 0 || risk.toInt() > 3
89
+ ) {
90
+ errors.add("risk must be an integer 0-3")
91
+ }
92
+
93
+ val scope = envelope.optString("scope", "")
94
+ if (scope.isEmpty()) {
95
+ errors.add("scope must be a non-empty string")
96
+ }
97
+
98
+ val status = envelope.optString("status", "")
99
+ if (status !in setOf("DRAFT", "READY", "AUTHORIZED", "REVIEW", "COMPLETE")) {
100
+ errors.add("status must be one of DRAFT, READY, AUTHORIZED, REVIEW, COMPLETE")
101
+ }
102
+
103
+ return errors
104
+ }
105
+ }
@@ -0,0 +1 @@
1
+ {"application_id":"ashshow","audit_preferences":{"receipts":true,"retain_days":30},"default_provider":"openai","identity":{"name":"AshShow Spirit","presence":"warm stage host"},"law":"Evolution without erasure. Invention without absorption. Wisdom without domination.","memory_policy":"ephemeral-session","namespace":"ashshow.spirit.settings","owner_id":"tucker","permissions":{"memory_consent":false,"provider_consent":false},"personality":{"boundaries":["never moves money","never publishes the Lab without explicit approval","never shares one workspace memory with another app"],"compassion":9,"curiosity":7,"directness":8,"reflection":7,"rituals":["opening welcome","closing gratitude"],"voice":"Host","wisdom_mode":"Story Led"},"provider_connections":[{"configured":true,"provider":"openai"},{"configured":false,"provider":"meta"}],"runflow_policy":"simulation-first","selected_model":"chatgpt-default","spirit_id":"spirit-ashshow-001","tool_allowlist":["read","simulate","publish-draft"],"updated_at":"2026-11-30T19:45:00-06:00"}
@@ -0,0 +1 @@
1
+ {"credentials":"server-side only. No credential, key, token, or secret is stored in this repository, in any file, at any time.","interface":"spirit-provider/v1","law":"Evolution without erasure. Invention without absorption. Wisdom without domination.","providers":[{"api":"OpenAI Responses API","auth":"server-side bearer credential, never in files","base_url":"https://api.openai.com/v1/responses","capabilities":["text","streaming"],"default_model_alias":"chatgpt-default","display_name":"ChatGPT","id":"openai","model_note":"No concrete OpenAI model name is asserted in this repository. The concrete model is bound server-side at runtime from the connected OpenAI account; the registry routes by the alias chatgpt-default until a model is named and recorded here with evidence.","models":[]},{"api":"Meta Model API","auth":"server-side bearer credential, never in files","base_url":"https://api.meta.ai/v1","capabilities":["text","streaming"],"default_model_alias":"muse-spark-1.3","display_name":"Muse","id":"meta","models":[{"id":"muse-spark-1.3","role":"default Spirit agent"},{"id":"muse-wonder-1.0","role":"complex research and engineering"},{"id":"muse-ember-1.0","role":"repeated bounded tasks"}]}],"registry":"spirit-provider-registry","routing":{"fallback":"none. If the selected provider is unavailable, the runtime returns an error receipt. It never falls back to the other provider on its own.","offline":"When no provider is reachable, the runtime answers from the local simulation only, labelled as simulated.","rule":"The caller selects a provider explicitly, or the app's Spirit settings select its default_provider. Provider switching is user-controlled; no provider is ever silently substituted."},"simulation":{"mode":"simulation-first","note":"All provider calls in this repository are simulated. The adapters describe the wire shape; the runtime never makes a live network call."},"status":"simulation-first","switching":"user-controlled","version":"0.1.0"}
@@ -0,0 +1 @@
1
+ {"application_id":"standalone","audit_preferences":{"receipts":true,"retain_days":90},"default_provider":"meta","identity":{"name":"Standalone Spirit","presence":"quiet companion"},"law":"Evolution without erasure. Invention without absorption. Wisdom without domination.","memory_policy":"ephemeral-session-isolated","namespace":"standalone.spirit.settings","owner_id":"tucker","permissions":{"memory_consent":false,"provider_consent":false},"personality":{"boundaries":["never moves money","never publishes or deploys without explicit approval","never substitutes providers silently"],"compassion":8,"curiosity":9,"directness":6,"reflection":9,"rituals":["breath pause before answering","deep-reflection close"],"voice":"Guide","wisdom_mode":"Inquiry Led"},"provider_connections":[{"configured":true,"provider":"meta"},{"configured":true,"provider":"openai"}],"runflow_policy":"simulation-first","selected_model":"muse-spark-1.3","spirit_id":"spirit-standalone-001","tool_allowlist":["read","simulate","verify"],"updated_at":"2026-11-30T19:45:00-06:00"}
@@ -0,0 +1,107 @@
1
+ import Capacitor
2
+ import Foundation
3
+
4
+ /// Capacitor bridge for Spirit Workplay (iOS).
5
+ /// The jsName "SpiritWorkplay" must match the registerPlugin name in
6
+ /// src/capacitor.ts and the @CapacitorPlugin name on Android.
7
+ @objc(SpiritWorkplayPlugin)
8
+ public class SpiritWorkplayPlugin: CAPPlugin, CAPBridgedPlugin {
9
+ public let identifier = "SpiritWorkplayPlugin"
10
+ public let jsName = "SpiritWorkplay"
11
+ public let pluginMethods: [CAPPluginMethod] = [
12
+ CAPPluginMethod(name: "listProviders", returnType: CAPPluginReturnPromise),
13
+ CAPPluginMethod(name: "getSettings", returnType: CAPPluginReturnPromise),
14
+ CAPPluginMethod(name: "simulatedReply", returnType: CAPPluginReturnPromise),
15
+ CAPPluginMethod(name: "validateEnvelope", returnType: CAPPluginReturnPromise),
16
+ CAPPluginMethod(name: "runtimeInfo", returnType: CAPPluginReturnPromise),
17
+ ]
18
+
19
+ private let store = SpiritWorkplayStore()
20
+
21
+ @objc func listProviders(_ call: CAPPluginCall) {
22
+ do {
23
+ let registry = try store.loadRegistry()
24
+ let providers: [[String: Any]] = registry.providers.map { provider in
25
+ [
26
+ "id": provider.id,
27
+ "display_name": provider.displayName,
28
+ "api": provider.api,
29
+ "base_url": provider.baseURL,
30
+ "default_model_alias": provider.defaultModelAlias,
31
+ "models": provider.models.map { ["id": $0.id, "role": $0.role] },
32
+ ]
33
+ }
34
+ call.resolve(["providers": providers])
35
+ } catch {
36
+ call.reject("failed to load provider registry: \(error.localizedDescription)")
37
+ }
38
+ }
39
+
40
+ @objc func getSettings(_ call: CAPPluginCall) {
41
+ guard let app = call.getString("app") else {
42
+ call.reject("app is required: 'standalone' or 'ashshow'")
43
+ return
44
+ }
45
+ do {
46
+ let settings = try store.loadSettingsObject(app: app)
47
+ call.resolve(["settings": settings])
48
+ } catch {
49
+ call.reject("unknown application: \(app)")
50
+ }
51
+ }
52
+
53
+ @objc func simulatedReply(_ call: CAPPluginCall) {
54
+ guard let provider = call.getString("provider"),
55
+ let model = call.getString("model"),
56
+ let input = call.getString("input") else {
57
+ call.reject("provider, model and input are required")
58
+ return
59
+ }
60
+ var voice = "Guide"
61
+ var wisdomMode = "Inquiry Led"
62
+ var ritual: String?
63
+ if let app = call.getString("app") {
64
+ do {
65
+ let settings = try store.loadSettings(app: app)
66
+ voice = settings.personality.voice
67
+ wisdomMode = settings.personality.wisdomMode
68
+ ritual = settings.personality.rituals.first
69
+ } catch {
70
+ call.reject("unknown application: \(app)")
71
+ return
72
+ }
73
+ }
74
+ let reply = SpiritWorkplayStore.simulatedReply(
75
+ provider: provider,
76
+ model: model,
77
+ input: input,
78
+ voice: voice,
79
+ wisdomMode: wisdomMode,
80
+ ritual: ritual
81
+ )
82
+ call.resolve(["reply": reply])
83
+ }
84
+
85
+ @objc func validateEnvelope(_ call: CAPPluginCall) {
86
+ guard let envelope = call.getObject("envelope") else {
87
+ call.reject("envelope is required")
88
+ return
89
+ }
90
+ let errors = SpiritWorkplayStore.validateEnvelope(envelope)
91
+ call.resolve(["valid": errors.isEmpty, "errors": errors])
92
+ }
93
+
94
+ @objc func runtimeInfo(_ call: CAPPluginCall) {
95
+ do {
96
+ let registry = try store.loadRegistry()
97
+ call.resolve([
98
+ "interface": registry.interfaceName,
99
+ "law": registry.law,
100
+ "version": "0.1.0",
101
+ "simulation": "simulation-first",
102
+ ])
103
+ } catch {
104
+ call.reject("failed to load provider registry: \(error.localizedDescription)")
105
+ }
106
+ }
107
+ }