ask-app-server 0.1.0 → 0.1.2
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.
- checksums.yaml +4 -4
- data/README.md +19 -11
- data/lib/ask/app_server/server.rb +34 -0
- data/lib/ask/app_server/session_store.rb +1 -0
- data/lib/ask/app_server/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 147a968eaddfd9ebce8ef4d0f04cb64c34e76a95e859a676ff79c75b270f6931
|
|
4
|
+
data.tar.gz: ce70ee81dfe2a5a0dcb4d1bd922b97d90f6aae5675c764df11bf99d1a585c7ae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 68a1c0af900543c31aedc96625c1df396507c44cc584267ad27e8ec9253d31029a79139537f3db0967b48ef6fee6cc33ace6ab1723b4b5741f6b436f40bdea0d
|
|
7
|
+
data.tar.gz: a4e0fa7e7a3004dbe8a7ca935254cb879d6a8125ee4e480520a28d5397653ed71fe40f896eacd3b0b98429bea3e8af88727684da590def6eb7d0d3b313aeb36d
|
data/README.md
CHANGED
|
@@ -2,16 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/rb/ask-app-server)
|
|
4
4
|
|
|
5
|
-
**JSON-RPC/stdio app-server for ask-rb agents.** Exposes `Ask::Agent::Session`
|
|
5
|
+
**JSON-RPC/stdio app-server for ask-rb agents.** Exposes `Ask::Agent::Session`
|
|
6
|
+
behind the standard app-server protocol: a vendor-neutral interface for
|
|
7
|
+
driving an agent as a service, with sessions, streamed events, approvals, and
|
|
8
|
+
turn lifecycle. Any client that implements the protocol can drive your agent,
|
|
9
|
+
and the client never needs to know it's talking to Ruby. The same protocol is
|
|
10
|
+
what several coding agents use behind their own app-servers (OpenAI's Codex
|
|
11
|
+
app-server is one well-known implementation); ask-app-server isn't an
|
|
12
|
+
extension of any of them — it simply speaks the standard.
|
|
6
13
|
|
|
7
14
|
## What is this?
|
|
8
15
|
|
|
9
16
|
`ask-app-server` turns an ask-rb agent into a **programmable service** that speaks JSON-RPC over stdio. Any client that can speak the app-server protocol can drive your agent:
|
|
10
17
|
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
14
|
-
- **Headless automation
|
|
18
|
+
- **IDE extensions and editors** — stream model deltas and tool events into an editor surface over stdio or a socket, the same way agent–editor integrations work today
|
|
19
|
+
- **Custom chat UIs and desktop apps** — stream model deltas and tool events into your own interface
|
|
20
|
+
- **Bots and assistants** — drive sessions programmatically from any runtime that can spawn a subprocess
|
|
21
|
+
- **Headless automation** — CI/CD pipelines, batch processing, scriptable agent tasks
|
|
15
22
|
|
|
16
23
|
## Installation
|
|
17
24
|
|
|
@@ -69,11 +76,12 @@ Event payloads are delivered as `session/event` notifications on subscribed sess
|
|
|
69
76
|
|
|
70
77
|
## Clients
|
|
71
78
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
Any client that speaks the app-server protocol can connect — including
|
|
80
|
+
existing app-server SDKs, such as OpenAI's `openai-codex` (Python) and
|
|
81
|
+
`@openai/codex-sdk` (TypeScript), which spawn an app-server subprocess and
|
|
82
|
+
drive it over stdio. Or write your own client in any language: the protocol
|
|
83
|
+
is documented and the wire format is plain JSON-RPC over newline-delimited
|
|
84
|
+
JSON.
|
|
77
85
|
|
|
78
86
|
## Configuration
|
|
79
87
|
|
|
@@ -101,7 +109,7 @@ bundle exec rake test
|
|
|
101
109
|
|
|
102
110
|
## Full documentation
|
|
103
111
|
|
|
104
|
-
The full ask-rb documentation lives at https://ask-rb.github.io/ask-docs. The [
|
|
112
|
+
The full ask-rb documentation lives at https://ask-rb.github.io/ask-docs. The [App Server guide](https://ask-rb.github.io/ask-docs/core/app-server) covers the protocol, events, and configuration; the [Gem reference](https://ask-rb.github.io/ask-docs/reference/gems) (Agent Infrastructure section) lists this gem alongside ask-acp and ask-coding-providers.
|
|
105
113
|
|
|
106
114
|
## License
|
|
107
115
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "json"
|
|
4
|
+
require "time"
|
|
4
5
|
|
|
5
6
|
module Ask
|
|
6
7
|
module AppServer
|
|
@@ -273,6 +274,39 @@ module Ask
|
|
|
273
274
|
{ aborted: true, sessionId: session_id }
|
|
274
275
|
end
|
|
275
276
|
|
|
277
|
+
# Artifacts: list the session's tool deliverables
|
|
278
|
+
handler("session/artifacts") do |params, _id|
|
|
279
|
+
session_id = params["sessionId"] || params[:sessionId]
|
|
280
|
+
raise InvalidRequest, "sessionId is required" unless session_id
|
|
281
|
+
|
|
282
|
+
adapter = @session_manager.get(session_id)
|
|
283
|
+
raise Ask::AppServer::SessionNotFound, "Session #{session_id} not found" unless adapter
|
|
284
|
+
|
|
285
|
+
agent = adapter.session
|
|
286
|
+
raise InvalidRequest, "session has no artifact store (artifacts: not enabled)" unless agent.artifact_store
|
|
287
|
+
|
|
288
|
+
{ artifacts: agent.artifacts }
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# Artifact: fetch one (content for inline artifacts, uri for
|
|
292
|
+
# external binaries)
|
|
293
|
+
handler("session/artifact/get") do |params, _id|
|
|
294
|
+
session_id = params["sessionId"] || params[:sessionId]
|
|
295
|
+
artifact_id = params["artifactId"] || params[:artifactId]
|
|
296
|
+
raise InvalidRequest, "sessionId and artifactId are required" unless session_id && artifact_id
|
|
297
|
+
|
|
298
|
+
adapter = @session_manager.get(session_id)
|
|
299
|
+
raise Ask::AppServer::SessionNotFound, "Session #{session_id} not found" unless adapter
|
|
300
|
+
|
|
301
|
+
agent = adapter.session
|
|
302
|
+
raise InvalidRequest, "session has no artifact store (artifacts: not enabled)" unless agent.artifact_store
|
|
303
|
+
|
|
304
|
+
record = agent.fetch_artifact(artifact_id)
|
|
305
|
+
raise InvalidRequest, "Artifact #{artifact_id} not found" unless record
|
|
306
|
+
|
|
307
|
+
{ artifact: record }
|
|
308
|
+
end
|
|
309
|
+
|
|
276
310
|
# Workspace: read state
|
|
277
311
|
handler("workspace/readState") do |params, _id|
|
|
278
312
|
@session_manager.read_workspace_state
|