durable_agent 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 (42) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +29 -0
  3. data/DESIGN.md +614 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +23 -0
  6. data/Rakefile +46 -0
  7. data/app/controllers/durable_agent/application_controller.rb +15 -0
  8. data/app/controllers/durable_agent/events_controller.rb +28 -0
  9. data/app/controllers/durable_agent/tools_controller.rb +33 -0
  10. data/app/models/concerns/durable_agent/harness_record.rb +11 -0
  11. data/app/models/durable_agent/application_record.rb +5 -0
  12. data/app/models/durable_agent/connection.rb +66 -0
  13. data/app/models/durable_agent/conversation.rb +107 -0
  14. data/app/models/durable_agent/document/revision.rb +16 -0
  15. data/app/models/durable_agent/document.rb +27 -0
  16. data/app/models/durable_agent/entry.rb +56 -0
  17. data/app/models/durable_agent/report.rb +14 -0
  18. data/app/models/durable_agent/submission.rb +57 -0
  19. data/app/models/durable_agent/task.rb +17 -0
  20. data/config/routes.rb +5 -0
  21. data/docs/guide.md +421 -0
  22. data/lib/durable_agent/account.rb +29 -0
  23. data/lib/durable_agent/client.rb +121 -0
  24. data/lib/durable_agent/configuration.rb +81 -0
  25. data/lib/durable_agent/current.rb +6 -0
  26. data/lib/durable_agent/engine.rb +7 -0
  27. data/lib/durable_agent/indexed_string.rb +14 -0
  28. data/lib/durable_agent/message_text.rb +23 -0
  29. data/lib/durable_agent/sidecar.rb +97 -0
  30. data/lib/durable_agent/test_helper.rb +110 -0
  31. data/lib/durable_agent/tool.rb +91 -0
  32. data/lib/durable_agent/version.rb +3 -0
  33. data/lib/durable_agent.rb +67 -0
  34. data/lib/generators/durable_agent/install/install_generator.rb +75 -0
  35. data/lib/generators/durable_agent/install/templates/create_durable_agent_tables.rb.tt +120 -0
  36. data/lib/generators/durable_agent/install/templates/durable_agent.rb.tt +36 -0
  37. data/lib/tasks/durable_agent_tasks.rake +6 -0
  38. data/sidecar/dist/sidecar.js +76417 -0
  39. data/sidecar/package.json +32 -0
  40. data/sidecar/sql/schema.postgres.sql +120 -0
  41. data/sidecar/sql/schema.sqlite.sql +120 -0
  42. metadata +115 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: dcbc54f59b44869460003f46d06f29a19f4a9b880025dafb0a6804c4c1af83ba
4
+ data.tar.gz: f0671aa9d4840dd8ba14ec7984818b20525bb1a2a3c3af4c69f78580d483d3bd
5
+ SHA512:
6
+ metadata.gz: e167e6b93c44f4126588df9444325d7b4834829da63d27427e63c97dd42515181d445e9ff1e1075f800f8043ccbd039369c0fc5fbd51f63eefccb5ad08112f50
7
+ data.tar.gz: 1aa9758d39afddeecdcb4f83851d899bd2497a2808d31c6a2dca62fd414ee1400f3ccb4501a51729fc76bbf00eb814562cf83f579762eb63968aed72a57a5ca1
data/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2026-10-20)
4
+
5
+ First release, to claim the name. Early: the contract (DESIGN.md) may still change.
6
+
7
+ - Accounts: `DurableAgent.start(account:)` runs a conversation on an account's own provider credentials (a user's
8
+ API key or ChatGPT plan) instead of the app's. `Connection.new(provider, account:)` signs an account in, with
9
+ `set_api_key`, `api_key?`, `source`, `scoped_provider` and `stream_name`; `DurableAgent.auth(account:)` and
10
+ `DurableAgent.auth_stream(account)` read and follow it; `Conversation#provider` and `#account` read the pinned
11
+ model (`"openai@u42/gpt-6.1-sol"`). `config.on_auth` receives scoped provider ids, and its default also
12
+ refreshes `"durable_agent:auth:<account>"` for each account named. `DurableAgent::Account` validates account
13
+ names. On the sidecar an account is a clone of the base provider under `openai@u42`, registered on demand and
14
+ at boot from the credentials table; it resolves only its own stored credential, never the environment. New
15
+ routes: `PUT /auth/:provider/api_key?account=`, `?account=` on `GET /auth`, logins and sign-out, `account` on
16
+ `POST /conversations`.
17
+ - First release: pi-durable as a bundled sidecar over the app's own database (Postgres or SQLite), read-only
18
+ Active Record models, Ruby tools, Turbo refreshes on change, sign-in and auth events, and
19
+ `DurableAgent::TestHelper` for apps' tests.
20
+ - The faux model is registered on every sidecar, so a conversation started on `faux/faux-1` keeps answering after
21
+ `DURABLE_AGENT_MODEL` moves to a real provider. `Conversation#model` reads the pinned model, and a `no_model`
22
+ submission's `explanation` names it.
23
+ - `Entry` exposes what pi-ai recorded on a message: `model_ref`, `stop_reason`, `error_message`, `usage`,
24
+ `total_tokens`, `cost`, `duration_ms`, `timestamp`; `failed?` marks an assistant entry that ended in an error or
25
+ abort, and `Conversation#last_failure` no longer counts one as an answer. `Conversation#usage`, `usage_by_model`,
26
+ `total_tokens` and `total_cost` read `pi.usage`. `model_error` and `run_failed` explanations carry pi-durable's
27
+ detail, such as the provider's OAuth error.
28
+ - `stub_sidecar` seals the client: calls it was not given raise `DurableAgent::Unavailable` instead of reaching a
29
+ sidecar that happens to be running.