Optional metadata or restamp builds the same commit history as node-red. A call that omits both stays digest-only with restamp false. Local and shared stamps reject metadata.
119 lines
4.8 KiB
Go
119 lines
4.8 KiB
Go
package tools
|
|
|
|
// StampArgs is the stamp tool input.
|
|
type StampArgs struct {
|
|
SHA256 string `json:"sha256" jsonschema:"SHA-256 digest (64 hex; optional sha256: prefix)"`
|
|
Scope string `json:"scope,omitempty" jsonschema:"local, shared, or global (default local)"`
|
|
CubeID string `json:"cube_id,omitempty" jsonschema:"optional cube id"`
|
|
OrgID string `json:"org_id,omitempty" jsonschema:"optional org id"`
|
|
Metadata map[string]any `json:"metadata,omitempty" jsonschema:"optional plain object or a verae-meta-git/1 history. Blank values do not delete fields. Global scope only."`
|
|
Restamp bool `json:"restamp,omitempty" jsonschema:"when true, append metadata onto the previous global stamp for this digest"`
|
|
Message string `json:"message,omitempty" jsonschema:"optional history commit message"`
|
|
}
|
|
|
|
// VerifyArgs is the verify tool input.
|
|
type VerifyArgs struct {
|
|
ReceiptID string `json:"receipt_id" jsonschema:"receipt or certificate id"`
|
|
WantScope string `json:"want_scope,omitempty" jsonschema:"optional minimum scope (local|shared|global)"`
|
|
}
|
|
|
|
// HashReportArgs is the hash_report tool input.
|
|
type HashReportArgs struct {
|
|
SHA256 string `json:"sha256" jsonschema:"SHA-256 digest (64 hex; optional sha256: prefix)"`
|
|
OrgID string `json:"org_id,omitempty" jsonschema:"optional org id filter"`
|
|
WantScope string `json:"want_scope,omitempty" jsonschema:"optional minimum scope filter"`
|
|
}
|
|
|
|
// AuthUserPass are credentials for signup/login.
|
|
type AuthUserPass struct {
|
|
Username string `json:"username" jsonschema:"VeraeTime username"`
|
|
Password string `json:"password" jsonschema:"VeraeTime password"`
|
|
}
|
|
|
|
// CreateUserArgs creates a VeraeTime user (admin bearer required).
|
|
type CreateUserArgs struct {
|
|
Username string `json:"username" jsonschema:"new username"`
|
|
Password string `json:"password" jsonschema:"new password"`
|
|
Role string `json:"role" jsonschema:"user or admin"`
|
|
}
|
|
|
|
// EmptyArgs is used by session.
|
|
type EmptyArgs struct{}
|
|
|
|
// ReceiptDTO is the MCP receipt shape (snake_case JSON).
|
|
type ReceiptDTO struct {
|
|
ReceiptID string `json:"receipt_id"`
|
|
Hash string `json:"hash"`
|
|
Scope string `json:"scope"`
|
|
CubeID string `json:"cube_id,omitempty"`
|
|
OrgID string `json:"org_id,omitempty"`
|
|
CreatedAt string `json:"created_at"`
|
|
Merkle string `json:"merkle"`
|
|
RestampOf string `json:"restamp_of,omitempty"`
|
|
}
|
|
|
|
// ReceiptsOut wraps a receipt list.
|
|
type ReceiptsOut struct {
|
|
Receipts []ReceiptDTO `json:"receipts"`
|
|
}
|
|
|
|
// VerifyOut is the verify tool result.
|
|
type VerifyOut struct {
|
|
Valid bool `json:"valid"`
|
|
Error string `json:"error,omitempty"`
|
|
Receipt *ReceiptDTO `json:"receipt,omitempty"`
|
|
}
|
|
|
|
// LoginOut is returned by login (never includes JWT).
|
|
type LoginOut struct {
|
|
Username string `json:"username"`
|
|
Role string `json:"role"`
|
|
ExpiresAt string `json:"expires_at"`
|
|
}
|
|
|
|
// SessionOut is returned by session.
|
|
type SessionOut struct {
|
|
Valid bool `json:"valid"`
|
|
Username string `json:"username,omitempty"`
|
|
Role string `json:"role,omitempty"`
|
|
ExpiresAt string `json:"expires_at,omitempty"`
|
|
}
|
|
|
|
// CreateUserOut is returned by signup and create_user.
|
|
type CreateUserOut struct {
|
|
ID string `json:"id,omitempty"`
|
|
Username string `json:"username"`
|
|
Role string `json:"role"`
|
|
}
|
|
|
|
// StampBatchArgs is the stamp_batch tool input (DEC-659).
|
|
type StampBatchArgs struct {
|
|
SHA256s []string `json:"sha256s" jsonschema:"SHA-256 digests (64 hex each), 1..500"`
|
|
Scope string `json:"scope,omitempty" jsonschema:"global (default; charged per new digest to your Verae account) or local"`
|
|
Metadata []map[string]any `json:"metadata,omitempty" jsonschema:"optional history patch per digest, same length as sha256s. Global scope only."`
|
|
Restamp bool `json:"restamp,omitempty" jsonschema:"when true, append each metadata patch onto the previous global stamp"`
|
|
Message string `json:"message,omitempty" jsonschema:"optional history commit message for every item"`
|
|
}
|
|
|
|
// BatchItemDTO is one item of a stamp_batch answer.
|
|
type BatchItemDTO struct {
|
|
Index int `json:"index"`
|
|
Hash string `json:"hash"`
|
|
JobID string `json:"job_id,omitempty"`
|
|
Status string `json:"status"`
|
|
Existing bool `json:"existing"`
|
|
ReceiptID string `json:"receipt_id,omitempty"`
|
|
Credits int `json:"credits"`
|
|
Error string `json:"error,omitempty"`
|
|
}
|
|
|
|
// StampBatchOut is the stamp_batch result: one receipt entry per input digest, in order.
|
|
type StampBatchOut struct {
|
|
Count int `json:"count"`
|
|
Created int `json:"created"`
|
|
Existing int `json:"existing"`
|
|
Failed int `json:"failed"`
|
|
TotalCredits int `json:"total_credits"`
|
|
BalanceCredits *int `json:"balance_credits,omitempty"`
|
|
Items []BatchItemDTO `json:"items"`
|
|
}
|