feat(arcrun): mira wiki page with tag filter + accumulated WIP
- landing/app/mira/wiki: tag=mira-wiki list now shows all wiki paragraphs (depends on KBDB tag filter exposed in matrix/kbdb commit, separate repo) - landing: app/mira hub + feed split + various WIP from prior sessions - registry/components: claude_api / kbdb_create_block / kbdb_get / km_writer / platform_crypto / auth_oauth2 contracts + main.go (accumulated) - .component-builds: pkg-lock updates + index.ts adjustments (WIP) - .agents/specs/arcrun/frontend-redesign: design notes - docs/test_credentials, docs/user_requirements/arcrun-landing-page: WIP docs - cypher-executor: auth-dispatcher / wasi-shim adjustments (WIP) Includes accumulated work from prior sessions plus the wiki UI tag-filter update that surfaces the AI-generated wiki paragraphs at /mira/wiki. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -24,10 +24,22 @@ func hostHttpRequest(
|
||||
) uint32
|
||||
|
||||
type Input struct {
|
||||
URL string `json:"url"`
|
||||
Method string `json:"method"`
|
||||
URL string `json:"url"`
|
||||
Method string `json:"method"`
|
||||
Headers map[string]string `json:"headers"`
|
||||
Body json.RawMessage `json:"body"`
|
||||
Body string `json:"body"`
|
||||
}
|
||||
|
||||
// dummy byte for safe zero-length unsafe.Pointer operations
|
||||
var dummy [1]byte
|
||||
|
||||
// safePtr returns a valid pointer for an empty-or-nonempty byte slice.
|
||||
// TinyGo panics with "index out of range" when taking &b[0] on empty b.
|
||||
func safePtr(b []byte) (uintptr, uint32) {
|
||||
if len(b) == 0 {
|
||||
return uintptr(unsafe.Pointer(&dummy[0])), 0
|
||||
}
|
||||
return uintptr(unsafe.Pointer(&b[0])), uint32(len(b))
|
||||
}
|
||||
|
||||
func main() {
|
||||
@@ -36,11 +48,13 @@ func main() {
|
||||
writeError("failed to read stdin: " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
var input Input
|
||||
if err := json.Unmarshal(raw, &input); err != nil {
|
||||
writeError("invalid input JSON: " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
if input.URL == "" {
|
||||
writeError("url 必填")
|
||||
return
|
||||
@@ -51,33 +65,29 @@ func main() {
|
||||
method = "GET"
|
||||
}
|
||||
|
||||
// 序列化 headers
|
||||
headersJSON := "{}"
|
||||
if len(input.Headers) > 0 {
|
||||
b, _ := json.Marshal(input.Headers)
|
||||
headersJSON = string(b)
|
||||
}
|
||||
|
||||
// body
|
||||
bodyStr := ""
|
||||
if len(input.Body) > 0 {
|
||||
bodyStr = string(input.Body)
|
||||
}
|
||||
|
||||
// 呼叫 host function
|
||||
urlBytes := []byte(input.URL)
|
||||
methodBytes := []byte(method)
|
||||
headersBytes := []byte(headersJSON)
|
||||
bodyBytes := []byte(bodyStr)
|
||||
|
||||
bodyBytes := []byte(input.Body)
|
||||
outBuf := make([]byte, 65536) // 64KB output buffer
|
||||
var outLen uint32
|
||||
|
||||
urlPtr, urlLen := safePtr(urlBytes)
|
||||
methodPtr, methodLen := safePtr(methodBytes)
|
||||
headersPtr, headersLen := safePtr(headersBytes)
|
||||
bodyPtr, bodyLen := safePtr(bodyBytes)
|
||||
|
||||
result := hostHttpRequest(
|
||||
uintptr(unsafe.Pointer(&urlBytes[0])), uint32(len(urlBytes)),
|
||||
uintptr(unsafe.Pointer(&methodBytes[0])), uint32(len(methodBytes)),
|
||||
uintptr(unsafe.Pointer(&headersBytes[0])), uint32(len(headersBytes)),
|
||||
uintptr(unsafe.Pointer(&bodyBytes[0])), uint32(len(bodyBytes)),
|
||||
urlPtr, urlLen,
|
||||
methodPtr, methodLen,
|
||||
headersPtr, headersLen,
|
||||
bodyPtr, bodyLen,
|
||||
uintptr(unsafe.Pointer(&outBuf[0])), uintptr(unsafe.Pointer(&outLen)),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user