Skip to content
Merged
4 changes: 2 additions & 2 deletions a2aremote/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ replace github.com/xraph/cortex => ../
require (
github.com/stretchr/testify v1.12.1
github.com/xraph/cortex v1.6.1
github.com/xraph/grove v1.10.2
github.com/xraph/grove/drivers/sqlitedriver v1.10.2
github.com/xraph/grove v1.10.3
github.com/xraph/grove/drivers/sqlitedriver v1.10.3
)

require (
Expand Down
8 changes: 4 additions & 4 deletions a2aremote/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWD
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
github.com/xraph/go-utils v1.5.0 h1:44pIJooK565ds/Ica0yyPoRNbr0qUTgj1aay8ewad1w=
github.com/xraph/go-utils v1.5.0/go.mod h1:fMahP6kPUjJP5UmzVje2GSL7OGT9+xpYkukK2dLjSMM=
github.com/xraph/grove v1.10.2 h1:3ZoKJpU21gIv8p98RjQE4wFcAhesXvTqSSqrroNOXaI=
github.com/xraph/grove v1.10.2/go.mod h1:oQ5d+MiSDkDxiRCKBOlmieJmzFXvanY/kk9VfvQO40w=
github.com/xraph/grove/drivers/sqlitedriver v1.10.2 h1:YLB9bGSxJnIquPN31etQGtrCWQfuuqfbcjk4eCkPT9Y=
github.com/xraph/grove/drivers/sqlitedriver v1.10.2/go.mod h1:UlTGQQRp7VD4Rjj8HN6XjW1TMZl0iSNI4LApoQnChYQ=
github.com/xraph/grove v1.10.3 h1:bTVuW6le1hIBLYzpmPBgcVO826FcncYYFFDJntZT7DY=
github.com/xraph/grove v1.10.3/go.mod h1:oQ5d+MiSDkDxiRCKBOlmieJmzFXvanY/kk9VfvQO40w=
github.com/xraph/grove/drivers/sqlitedriver v1.10.3 h1:a7f/Ir/4iMQsE+EDshgOtUf+Vpu2EIhOMsVDlONveeI=
github.com/xraph/grove/drivers/sqlitedriver v1.10.3/go.mod h1:UlTGQQRp7VD4Rjj8HN6XjW1TMZl0iSNI4LApoQnChYQ=
github.com/xraph/shield v1.10.2 h1:LJlnTeXvDov+GBPhOGsnyoiH/1Zsx5gaOPfNfSAGoxU=
github.com/xraph/shield v1.10.2/go.mod h1:xkWUxiFghxQV74UVNfDsSz/mCjQ18mpt4W4kxGiBqJU=
github.com/xraph/vessel v1.0.5 h1:4In3UmIJzOrym5+FXE/uvm1jR+gofUqVmEjKjjgE3gw=
Expand Down
8 changes: 4 additions & 4 deletions a2aremote/grpcbind/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWD
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
github.com/xraph/go-utils v1.5.0 h1:44pIJooK565ds/Ica0yyPoRNbr0qUTgj1aay8ewad1w=
github.com/xraph/go-utils v1.5.0/go.mod h1:fMahP6kPUjJP5UmzVje2GSL7OGT9+xpYkukK2dLjSMM=
github.com/xraph/grove v1.10.2 h1:3ZoKJpU21gIv8p98RjQE4wFcAhesXvTqSSqrroNOXaI=
github.com/xraph/grove v1.10.2/go.mod h1:oQ5d+MiSDkDxiRCKBOlmieJmzFXvanY/kk9VfvQO40w=
github.com/xraph/grove/drivers/sqlitedriver v1.10.2 h1:YLB9bGSxJnIquPN31etQGtrCWQfuuqfbcjk4eCkPT9Y=
github.com/xraph/grove/drivers/sqlitedriver v1.10.2/go.mod h1:UlTGQQRp7VD4Rjj8HN6XjW1TMZl0iSNI4LApoQnChYQ=
github.com/xraph/grove v1.10.3 h1:bTVuW6le1hIBLYzpmPBgcVO826FcncYYFFDJntZT7DY=
github.com/xraph/grove v1.10.3/go.mod h1:oQ5d+MiSDkDxiRCKBOlmieJmzFXvanY/kk9VfvQO40w=
github.com/xraph/grove/drivers/sqlitedriver v1.10.3 h1:a7f/Ir/4iMQsE+EDshgOtUf+Vpu2EIhOMsVDlONveeI=
github.com/xraph/grove/drivers/sqlitedriver v1.10.3/go.mod h1:UlTGQQRp7VD4Rjj8HN6XjW1TMZl0iSNI4LApoQnChYQ=
github.com/xraph/shield v1.10.2 h1:LJlnTeXvDov+GBPhOGsnyoiH/1Zsx5gaOPfNfSAGoxU=
github.com/xraph/shield v1.10.2/go.mod h1:xkWUxiFghxQV74UVNfDsSz/mCjQ18mpt4W4kxGiBqJU=
github.com/xraph/vessel v1.0.5 h1:4In3UmIJzOrym5+FXE/uvm1jR+gofUqVmEjKjjgE3gw=
Expand Down
4 changes: 2 additions & 2 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ require (
github.com/xraph/cortex v1.8.1-0.20261025225257-d0eb82f6ed68
github.com/xraph/cortex/optimization v0.0.0-20261026160546-1b6f6bc9f367
github.com/xraph/forge v1.13.6
github.com/xraph/grove v1.10.2
github.com/xraph/grove/drivers/sqlitedriver v1.10.2
github.com/xraph/grove v1.10.3
github.com/xraph/grove/drivers/sqlitedriver v1.10.3
)

require (
Expand Down
8 changes: 4 additions & 4 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,10 @@ github.com/xraph/forge v1.13.6 h1:JCLMd1eEd7Ay96iVg8tFlYDBMyVO8ltZSIMGRL7ktko=
github.com/xraph/forge v1.13.6/go.mod h1:gg/KN2RcPOZl0DMxLRp7QQYBW3wLscXgYdUzfcpWDeI=
github.com/xraph/go-utils v1.5.0 h1:44pIJooK565ds/Ica0yyPoRNbr0qUTgj1aay8ewad1w=
github.com/xraph/go-utils v1.5.0/go.mod h1:fMahP6kPUjJP5UmzVje2GSL7OGT9+xpYkukK2dLjSMM=
github.com/xraph/grove v1.10.2 h1:3ZoKJpU21gIv8p98RjQE4wFcAhesXvTqSSqrroNOXaI=
github.com/xraph/grove v1.10.2/go.mod h1:oQ5d+MiSDkDxiRCKBOlmieJmzFXvanY/kk9VfvQO40w=
github.com/xraph/grove/drivers/sqlitedriver v1.10.2 h1:YLB9bGSxJnIquPN31etQGtrCWQfuuqfbcjk4eCkPT9Y=
github.com/xraph/grove/drivers/sqlitedriver v1.10.2/go.mod h1:UlTGQQRp7VD4Rjj8HN6XjW1TMZl0iSNI4LApoQnChYQ=
github.com/xraph/grove v1.10.3 h1:bTVuW6le1hIBLYzpmPBgcVO826FcncYYFFDJntZT7DY=
github.com/xraph/grove v1.10.3/go.mod h1:oQ5d+MiSDkDxiRCKBOlmieJmzFXvanY/kk9VfvQO40w=
github.com/xraph/grove/drivers/sqlitedriver v1.10.3 h1:a7f/Ir/4iMQsE+EDshgOtUf+Vpu2EIhOMsVDlONveeI=
github.com/xraph/grove/drivers/sqlitedriver v1.10.3/go.mod h1:UlTGQQRp7VD4Rjj8HN6XjW1TMZl0iSNI4LApoQnChYQ=
github.com/xraph/shield v1.10.2 h1:LJlnTeXvDov+GBPhOGsnyoiH/1Zsx5gaOPfNfSAGoxU=
github.com/xraph/shield v1.10.2/go.mod h1:xkWUxiFghxQV74UVNfDsSz/mCjQ18mpt4W4kxGiBqJU=
github.com/xraph/vessel v1.0.5 h1:4In3UmIJzOrym5+FXE/uvm1jR+gofUqVmEjKjjgE3gw=
Expand Down
48 changes: 48 additions & 0 deletions checkpoint/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,30 @@
package checkpoint

import (
"encoding/json"
"time"

"github.com/xraph/cortex"
"github.com/xraph/cortex/id"
)

// MetadataKind is the metadata key that names what a checkpoint the engine
// opened is waiting on. It is set to KindDeferredModelCall on a checkpoint
// opened for a deferred model call, and absent on a tool approval.
const MetadataKind = "kind"

// KindDeferredModelCall is the MetadataKind of a checkpoint opened because
// the model client deferred a call (cortex.DeferredModelCallError). Such a
// checkpoint has no pending tool calls. An approval continues the run with
// the same model call; a rejection stops the run with the decision's
// reason. A decision that carries Calls or AmendedArguments is refused
// with cortex.ErrInvalidDecision.
const KindDeferredModelCall = "deferred_model_call"

// MetadataDeferralKind is the metadata key that carries
// cortex.DeferredModelCallError.Kind on a deferred model call's checkpoint.
const MetadataDeferralKind = "deferral_kind"

// Decision represents the resolution of a checkpoint.
type Decision struct {
Approved bool `json:"approved"`
Expand All @@ -23,6 +41,36 @@ type Decision struct {
// Anything that serves a checkpoint to a reader goes through
// Checkpoint.Public, which drops it.
DecidedByPrincipal []byte `json:"decided_by_principal,omitempty"`
// AmendedArguments, on an approval, are the arguments the suspended
// call runs with instead of the model's. They replace the whole
// argument object, nothing is merged. They must be a JSON object, and
// the suspension must hold exactly one pending call, or the decision
// is refused with cortex.ErrInvalidDecision. The engine does not
// validate them against the tool's schema; that is the caller's job.
// A rejection ignores them and does not record them.
AmendedArguments json.RawMessage `json:"amended_arguments,omitempty"`
// Calls decides each pending tool call on its own, keyed by the
// pending call's id. When it is set, Approved is derived (true when
// any call is approved), AmendedArguments must be empty, and every
// pending call must have an entry and every entry must name a
// pending call, or the decision is refused with
// cortex.ErrInvalidDecision. A rejected call's Reason is what the
// model reads for that call. When it is empty, Approved and
// AmendedArguments decide every pending call together.
Calls map[string]CallDecision `json:"calls,omitempty"`
}

// CallDecision is the outcome of one pending tool call within a Decision.
type CallDecision struct {
// Approved runs the call. A call that is not approved is rejected
// and answered with Reason.
Approved bool `json:"approved"`
// AmendedArguments, on an approved call, replace the whole argument
// object the call runs with. They must be a JSON object. A rejected
// call ignores them.
AmendedArguments json.RawMessage `json:"amended_arguments,omitempty"`
// Reason is what the model reads when the call is rejected.
Reason string `json:"reason,omitempty"`
}

// Checkpoint represents a point where a run pauses for approval.
Expand Down
Loading
Loading